2 bug fixes - see included diff

Robin
2007-04-10
2013-05-02
  • Robin
    Robin
    2007-04-10

    I've found 2 bugs with BMP support.

    Firstly, for 32bpp images the alpha channel can be replaced with uninitialised memory.
    Secondly, for 24bpp images are incorrectly padded.

    The fix for this is appended. I don't know how I go about getting write access to the source - so perhaps someone would apply this on my behalf.

    cvs diff -- ilut_win32.c (in directory C:\rcharlton\DevIl-CVS\DevIL\src-ILUT\src\)
    Index: ilut_win32.c
    ===================================================================
    RCS file: /cvsroot/openil/DevIL/src-ILUT/src/ilut_win32.c,v
    retrieving revision 1.27
    diff -r1.27 ilut_win32.c
    249a250,253
    >
    >             // Copy the alpha channel if present.
    >             if (Image->Bpp == 4)
    >                 TempBuff[i+3] = TempData[i+3];
    257c261
    <     NewData = (ILubyte*)ialloc((Image->Width + PadSize) * Image->Height * Image->Bpp);
    ---
    >     NewData = (ILubyte*)ialloc((Image->Bps + PadSize) * Image->Height);
    305c309
    <     NewBps = ilutCurImage->Bps/* + Padding*/;
    ---
    >     NewBps = ilutCurImage->Bps + Padding;

     
    • Denton Woods
      Denton Woods
      2008-09-22

      Thanks for the patch.  Sorry that it took awhile for it to be applied.