[FFmpeg-devel] [PATCH] ffm: reject a negative codec_id

Andreas Cadhalpun andreas.cadhalpun at googlemail.com
Tue Dec 15 01:19:01 CET 2015


On 15.12.2015 00:43, Michael Niedermayer wrote:
> On Tue, Dec 15, 2015 at 12:03:22AM +0100, Andreas Cadhalpun wrote:
>> A negative codec_id cannot be handled by the found_decoder API of
>> AVStream->info: if the codec_id is not recognized, found_decoder is set
>> to -codec_id, which has to be '<0' according to the API documentation.
>>
>> This can cause NULL pointer dereferencing in try_decode_frame.
>>
>> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
>> ---
>>  libavformat/ffmdec.c | 12 ++++++++++++
>>  1 file changed, 12 insertions(+)
> 
> can avcodec_descriptor_get() be used instead of < 0 to check the codec
> ids validity ?

Yes.

> codec_type could be checked too that way

Why not. Updated patch attached.

Best regards,
Andreas

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ffm-reject-invalid-codec_id-and-codec_type.patch
Type: text/x-diff
Size: 3341 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20151215/56c927b4/attachment.patch>


More information about the ffmpeg-devel mailing list