[FFmpeg-devel] [PATCH] Fix 64 bit truncation in asfdec.c

David DeHaven dave
Fri May 29 06:58:26 CEST 2009

>>>> -static int get_value(ByteIOContext *pb, int type){
>>>> +static uint64_t get_value(ByteIOContext *pb, int type){
>>> why do you change it from signed to unsigned?
>> It's only used to read boolean (where sign doesn't matter since  
>> it's one or
>> zero), WORD, DWORD or QWORD which AFAIK are all unsigned values.  
>> That, and
>> it's only called once in the file and it's cast to uint64_t.
> well INT64_MIN doesnt fit in and your patch adds that

Hrm, good point :)

> also if some positive value indicates failure that should be  
> documented
> because its not common but honestly keeping it signed seems like the  
> easier
> way

I'd ask the maintainer for advice, but there doesn't seem to be one :)

I'm not sure it matters either way since this is so obscure, but if  
something is expecting unsigned there could be an issue if we return a  
signed value (if the high bit is set). OTOH, none of the samples I  
have even set the high byte, let alone the high bit. It could just  
return zero on error since there's no error checking anyways. I'll  
think about it and address it tomorrow AM.


More information about the ffmpeg-devel mailing list