[Ffmpeg-devel][PATCH] Possible bug in bmp decoder

Michael Niedermayer michaelni
Mon Jan 29 23:56:41 CET 2007


Hi

On Mon, Jan 29, 2007 at 03:05:17PM +0100, Michel Bardiaux wrote:
> Reimar Doeffinger wrote:
> >Hello,
> >On Mon, Jan 29, 2007 at 02:18:47PM +0100, Michel Bardiaux wrote:
> >>Alex Beregszaszi wrote:
> >>>>...
> >>>>    switch(depth){
> >>>>    case 24:
> >>>>        for(i = 0; i < avctx->height; i++){
> >>>>            memcpy(ptr, buf, n);
> >>>>            buf += n;
> >>>>            ptr += linesize;
> >>>>        }
> >>>>        break;
> >>>>...
> >>>>
> >>>>Should it not be memcpy(ptr, buf, linesize) ?
> >>>n probably means input linesize, while linesize is the output linesize.
> >>Yes.
> >>
> >>>I guess 24bit BMP doesnt stores the padding 1 byte.
> >>Actually it does, see
> >>
> >>    /* Line size in file multiple of 4 */
> >>    n = (avctx->width * (depth / 8) + 3) & ~3;
> >>
> >>and that's why I am suspicious.
> >
> >Neither is right, avctx->width * (depth >> 3) is the right value.
> 
> Yes. Patch attached.

looks ok assuming mans has no objections

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The worst form of inequality is to try to make unequal things equal.
-- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070129/e83eaf60/attachment.pgp>



More information about the ffmpeg-devel mailing list