[FFmpeg-devel] [PATCH 2/2] libavformat/takdec.c: Fix msan error.

James Almer jamrial at gmail.com
Thu Apr 17 23:25:39 EEST 2025


On 4/17/2025 4:08 PM, Thierry Foucu wrote:
> On Mon, Apr 7, 2025 at 11:10 AM <tfoucu at google.com> wrote:
> 
>> From: Thierry Foucu <tfoucu at gmail.com>
>>
>> Make sure we are reading 16 bytes for the MD5
>> ---
>>   libavformat/takdec.c | 5 ++++-
>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/libavformat/takdec.c b/libavformat/takdec.c
>> index 21fff3fcbf..61b9f001c4 100644
>> --- a/libavformat/takdec.c
>> +++ b/libavformat/takdec.c
>> @@ -19,6 +19,7 @@
>>    * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
>> 02110-1301 USA
>>    */
>>
>> +#include <libavutil/error.h>
>>   #include "libavutil/crc.h"
>>   #include "libavutil/mem.h"
>>
>> @@ -116,7 +117,9 @@ static int tak_read_header(AVFormatContext *s)
>>               if (size != 19)
>>                   return AVERROR_INVALIDDATA;
>>               ffio_init_checksum(pb, tak_check_crc, 0xCE04B7U);
>> -            avio_read(pb, md5, 16);
>> +            if (avio_read(pb, md5, 16) != 16) {
>> +                return AVERROR(EIO);

Should be AVERROR_INVALIDDATA imo, since i means the file is just 
truncated. It wasn't an error in the protocol reading data.

Will amend with that change and push. Thanks.

>> +            }
>>               if (ffio_get_checksum(s->pb) != avio_rb24(pb)) {
>>                   av_log(s, AV_LOG_ERROR, "MD5 metadata block CRC
>> error.\n");
>>                   if (s->error_recognition & AV_EF_EXPLODE)
>> --
>> 2.49.0.504.g3bcea36a83-goog
>>
>>
> Ping?
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20250417/04eae3a4/attachment.sig>


More information about the ffmpeg-devel mailing list