[FFmpeg-devel] [PATCH] jpeg2000dec: simplify jpeg2000_read_bitstream_packets()

Paul B Mahol onemda at gmail.com
Wed Jul 24 13:39:53 CEST 2013


On 7/24/13, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Tue, Jul 23, 2013 at 10:21:27PM +0000, Carl Eugen Hoyos wrote:
>> Michael Niedermayer <michaelni <at> gmx.at> writes:
>>
>> > +    atom_end  = bytestream2_tell(&s->g) + atom_size - 8;
>>
>> > +    if (bytestream2_get_bytes_left(&s->g) < atom_size ||
>> > atom_end < atom_size)
>>
>> Could you explain what atom_end < atom_size is supposed
>> to check?
>
> integer overflow

But isn't integer overflow undefined behavior, and thus checking
result after overflow is not 100% safe?

>
>
> [...]
>
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> The worst form of inequality is to try to make unequal things equal.
> -- Aristotle
>


More information about the ffmpeg-devel mailing list