On Tue, Feb 19, 2013 at 06:36:36PM +0100, Nicolas BERTRAND wrote:
> Le 19/02/2013 09:29, Kostya Shishkov a écrit :
> >>+static int tag_tree_size(int w, int h)
> >>>+{
> >>>+ int res = 0;
> >>>+ while (w > 1 || h > 1){
> >>>+ res += w * h;
> >>>+ w = (w+1) >> 1;
> >>>+ h = (h+1) >> 1;
> >>>+ }
> >>>+ return res + 1;
> >The value obtained here may be too large, so it would be nice to check it.
> >
> you mean modifications like
> static uint16_t tag_tree_size(int w, int h)
> {
> uint32_t res = 0;
> while (w > 1 || h > 1) {
> res += w * h;
> if ( (res + 1) >= MAX_UINT16)
> return NULL;
> w = (w + 1) >> 1;
> h = (h + 1) >> 1;
> }
> return (uint16_t)(res + 1);
> }
not sure about the actual limit but returning -1 in case of too large value
would be nice
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel