Results 1 to 2 of 2

Thread: Paq8o8 - endless loop when BMPs are invalid

  1. #1
    Programmer schnaader's Avatar
    Join Date
    May 2008
    Hessen, Germany
    Thanked 245 Times in 123 Posts
    When compressing BMP files where bytes 2-6 in the header (size of
    the BMP in bytes) are set to 0, paq8o8 seems to run in some
    endless loop. This also happens if compression level is set to 0!

    Here are some test files:
    The archive contains both 8-bit and 24-bit BMPs with sizes 32x32,
    one that works (Bytes 2-6 set correct) and one that causes paq8o8
    to hang (Bytes 2-6 set to 0).

    Looking at the paq8o8 source code, I didn't find these bytes used
    anywhere, only 'BM' and some other fields are checked. Changing
    the bytes to something different than 0 (below or above the correct
    BMP size) didn't have the same effect (except that sometimes the
    BMP isn't recognized).

    Most BMP header descriptions emphasize that these bytes are
    unreliable anyway, so changing them shouldn't have an effect.
    In fact, I checked some picture viewers and none of them even
    gave a warning.
    Damn kids. They're all alike.

  2. #2
    Join Date
    May 2008
    Thanked 353 Times in 188 Posts
    if (bmp && (i-bmp)==4){
    bsize=bswap(buf0); //image size <-- takes image size at offset 2-6
    if (bmp && (i-bmp)==(27)) imgbpp=c; //image bpp
    if ((type==BMPFILE4 || type==BMPFILE8 || type==BMPFILE24 ) && bmp0 && buf0==0 && (imgbpp==4 || imgbpp==8 || imgbpp==24)){
    return fseek(in, start+bsize, SEEK_SET),DEFAULT; <-- if bsize=0 endless loop

    To correct this: height*width+header(+pal) versus bsize check.
    Notify if not same and use height*width+header(+pal) result.

    I assumed that at that offset i can read correct data.
    I assumed to much.

Similar Threads

  1. LLVM 2.6 released, quick try with paq8o8
    By Hahobas in forum The Off-Topic Lounge
    Replies: 1
    Last Post: 29th November 2009, 22:31
  2. Strange gcc4.3 results with paq8o8
    By Hahobas in forum Forum Archive
    Replies: 8
    Last Post: 22nd March 2008, 20:44
  3. PAQ8o8 threading observations
    By CodeMutant in forum Forum Archive
    Replies: 15
    Last Post: 18th February 2008, 11:02

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts