[Ffmpeg-devel] [PATCH] from DivX, Part 1: cosmectic changes

Måns Rullgård mru
Fri Dec 16 22:37:02 CET 2005


Steve Lhomme <slhomme at divxcorp.com> writes:

>>>>@@ -713,8 +713,8 @@
>>>>    else
>>>>        io_buffer_size = 1024;
>>>>        -    if(sizeof(DynBuffer) + io_buffer_size < io_buffer_size)
>>>>-        return -1;
>>>>+    assert(sizeof(DynBuffer) + io_buffer_size >= io_buffer_size);
>>>>+
>>>>
>>>>
>>>
>>>?
>> such changes are not acceptable
>
> Ah. But this one is the most interresting patch.
>
> Because if you look at the original code. I can't think of any case
> where this is true. So I'd better remove it of my Release (no assert)
> builds.

The type of a sizeof() expression is size_t, which is unsigned.  Hence
sizeof(foo) + x < x is impossible, unless the addition overflows.

-- 
M?ns Rullg?rd
mru at inprovide.com





More information about the ffmpeg-devel mailing list