[FFmpeg-devel] [PATCH v2 3/7] avformat/hlsenc: Check some unchecked allocations
Nicolas George
george at nsup.org
Thu Apr 9 14:12:49 EEST 2020
Limin Wang (12020-04-09):
> Sorry, it seems that I remove these checking when av_dirname claims to support
> NULL for path in the API comments like glib dirname function. So I think it's
> duplicate check if the function claims to support NULL.
"Supporting NULL" can mean anything, and therefore means nothing. You
should have tested that your new code produced the exact same results as
the old code. Apparently, you neglected to do that.
In the future, remember: if you change something non trivial, test it.
> I don't know why dirname support NULL?
It was a terrible idea: NULL is not a valid file name, and therefore it
makes no sense to take its dir name.
This is "defensive programming": returning random results for invalid
values instead of errorring properly. It is a very bad habit, it leads
to corrupted files and security issues.
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/637ef099/attachment.sig>
More information about the ffmpeg-devel
mailing list