ffm: reject invalid codec_id and codec_type
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Mon, 14 Dec 2015 21:11:55 +0000 (22:11 +0100)
committerAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Thu, 17 Dec 2015 20:37:23 +0000 (21:37 +0100)
commitf7b4e4625120867a277cec9647392700fafedfcc
tree5c358659b7b18ccaa21727520b9c60a3c4aa1f0d
parent1828abb7449a06c71a6f1199efc9b5e480502603
ffm: reject invalid codec_id and codec_type

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.

Also make sure the codec_type matches the expected one for codec_id.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
(cherry picked from commit ecf63b7cc24b9fd3e6d604313325dd1ada4db662)
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
libavformat/ffmdec.c