[FFmpeg-devel] [PATCH v2 3/7] avformat/hlsenc: Check some unchecked allocations

Nicolas George george at nsup.org
Thu Apr 9 11:49:53 EEST 2020


Steven Liu (12020-04-09):
> It’s unnecessary here,
> I have checked all strdup return checker in hlsenc some month ago, and double check the workflow in update_master_pl_info,
> It's the safe whether you check the strdup or not.
> Reference commit id: 61aa77272a25d83e5ce5c63d93c64bb9a3e15557

Honestly, I think that relying on string functions to all check for NULL
to guard against a memory allocation failure is very terrible design.
More importantly, it is fragile: it takes only one string function that
does not support NULL to make it crash. And since it is neither obvious
nor documented in the code (I am not talking about the doxy of the
string functions, I am talking about the fact that it relies on it), you
will endlessly get patches like that to restore them. And if somebody
decides to copy the code but is not careful about the string function it
uses, again, crash.

I vote for properly checking memory allocations as they happen.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20200409/5fe245c0/attachment.sig>


More information about the ffmpeg-devel mailing list