madler / zlib

A massively spiffy yet delicately unobtrusive compression library.
http://zlib.net/
Other
5.71k stars 2.45k forks source link

when uncompress data below, the data is uncompressed successfully, but the return value is wrong. #786

Closed baosj0 closed 1 year ago

baosj0 commented 1 year ago

const uint8 data[] = {0x78,0x01,0xec,0x58,0x6f,0x6c,0x14,0xc7,0x15,0x7f,0xbb,0x77,0x06,0xfb,0x82,0xc1,0x06,0x43,0x80,0x38,0x64,0xf1,0x95,0x3f,0x21,0x3e,0x77,0x77,0xef,0x0f,0x77,0x90,0x23,0xde,0xbd,0xdb,0xc3,0xa4,0x76,0xce,0x85,0x08,0x57,0xea,0xb5,0xdc,0xfa,0x7c,0x8e,0x8f,0xda,0x77,0xd6,0xdd,0xb9,0x98,0x22,0xe8,0x19,0x22,0x85,0x7c,0xa0,0x8a,0xda,0x0a,0x45,0xf9,0x92,0x54,0xed,0x07,0x54,0x54,0x29,0x69,0xa5,0xb6,0x6a,0xda,0x06,0x22,0x14,0x55,0x55,0x95,0x46,0x2a,0xa2,0xa5,0x69,0x95,0xa4,0xdf,0xf8,0x50,0x89,0x6f,0x95,0xaa,0x96,0xeb,0xef,0xed,0xde,0xe2,0xb5,0x71,0xf1,0xd5,0xf9,0x10,0xa1,0x32,0xab,0xdf,0xce,0xdb,0x37,0x33,0xef,0xbd,0x99,0x79,0x33,0xfb,0x66,0x3e,0xf8,0x7d,0xe7,0xc7,0xdf,0x7b,0x6b,0xeb,0x27,0xb4,0x28,0x1d,0x20,0x0f,0xdd,0xa9,0xb7,0xd1,0x2a,0x17,0x5f,0x00,0xcd,0xb0,0x52,0x07,0x91,0x08,0x82,0xbf,0xef,0xd4,0xeb,0x75,0x8b,0x87,0x17,0xc8,0x87,0xe9,0x01,0x1a,0x81,0x7f,0xc3,0xd6,0xd5,0x8d,0x39,0xf4,0x22,0x6f,0x01,0x78,0xce,0x5b,0x1b,0xbc,0x36,0xe4,0x3e,0xe0,0x11,0x60,0x4d,0x83,0xf7,0x00,0x75,0xef,0xa1,0xa9,0xcb,0x8c,0xc0,0x61,0x2a,0xe1,0xa9,0x92,0x44,0x06,0x15,0x91,0x97,0xe9,0x24,0x66,0xb9,0xf9,0xb4,0x09,0x1e,0xe3,0xa8,0x60,0xdf,0xb9,0x5f,0xea,0xff,0xa4,0xfd,0xc3,0x9b,0xc6,0x4d,0xc1,0x83,0x4a,0x57,0x3a,0xed,0x9a,0x47,0x49,0x27,0xed,0x7e,0x8d,0x96,0x29,0x6b,0xc5,0x0e,0xe4,0xe8,0x67,0xb9,0x4b,0x25,0xf9,0x17,0xb6,0x5e,0x47,0xbf,0xbb,0xce,0x18,0x15,0xd0,0xe7,0x95,0xa7,0x56,0xec,0x82,0x8e,0x7e,0xce,0x9b,0x95,0xf4,0x1e,0x6f,0x9c,0x48,0xdb,0x8f,0x8f,0x8c,0x28,0x36,0xb9,0xa2,0x37,0xf4,0x0b,0xbc,0x0f,0xf3,0xda,0x6d,0x56,0x3f,0xaf,0xed,0x2d,0x8d,0xc9,0x62,0x33,0xb8,0x3d,0x8f,0x9d,0x7b,0xfd,0x3b,0x7b,0xc2,0xe2,0xf5,0xdf,0x8e,0x7a,0x6b,0x81,0x75,0x40,0x07,0xd0,0x09,0xac,0x07,0x36,0x00,0x5d,0xc0,0x46,0x60,0x13,0xf0,0x28,0xb0,0x19,0xd8,0x02,0x6c,0x05,0x1e,0x03,0xba,0x01,0xfe,0x57,0x6c,0x43,0xfe,0x04,0x20,0x01,0xdb,0x81,0x1e,0xc0,0x0f,0x7c,0x0e,0xd8,0x01,0xec,0x04,0x76,0x01,0xbb,0x81,0x27,0x81,0x3d,0xc0,0x53,0x40,0x2f,0x10,0x00,0xfa,0x80,0xcf,0x03,0x32,0xa0,0x00,0x2a,0x10,0x04,0x42,0x40,0x18,0x88,0x00,0x7b,0x81,0x28,0x10,0x03,0xf6,0x01,0xfb,0x81,0xa7,0x81,0x38,0x70,0x00,0x78,0x06,0x60,0x5b,0x34,0xe4,0x3a,0x90,0x00,0x92,0x80,0x01,0x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x7f,0xd5,0x6a,0xb7,0xe5,0x77,0x07,0xe2,0x5f,0x1e,0x71,0x3e,0xb3,0xb2,0x0d,0xcc,0x5b,0x2e,0xf5,0xa3,0xc2,0x48,0x63,0x9a,0x16,0xea,0x3f,0x41,0x53,0xcb,0x35,0x5e,0x54,0xde,0xb5,0x82,0xfe,0xa7,0x20,0xa3,0x63,0x91,0x9c,0x4f,0xf3,0xe9,0x8c,0x7d,0xb3,0xfd,0x77,0xeb,0xb2,0x67,0x3f,0xd3,0xf0,0x82,0x08,0x7c,0x84,0x39,0x06,0xbc,0xac,0x0f,0xf1,0xf0,0x20,0x1e,0x3f,0x38,0x05,0x04,0x70,0x33,0x64,0xd2,0x24,0x49,0x28,0x35,0xf1,0x55,0xa0,0x1c,0xe8,0x14,0x42,0xba,0x32,0x72,0x8d,0xa6,0xf1,0x4c,0x5a,0x5c,0x13,0xa1,0x5e,0x01,0xfc,0x22,0x6a,0xb9,0xd3,0x4e,0xc1,0x59,0x07,0x31,0xf8,0x62,0x08,0x9e,0x1b,0xc4,0x3b,0x04,0x2f,0x0e,0x20,0x6a,0xd7,0xf0,0xad,0x80,0x52,0xf0,0x24,0xac,0xb5,0x11,0x45,0x0c,0xcf,0x1e,0x6f,0xaf,0x03,0x0d,0x35,0xf8,0x2b,0x02,0xa8,0x78,0x07,0x61,0x07,0xaf,0x03,0x15,0x76,0x46,0x91,0xf3,0x5a,0x70,0xd6,0x41,0x19,0xda,0x5f,0x80,0x5d,0x26,0x66,0x93,0x6d,0x2c,0xc0,0xb2,0x3c,0xac,0x91,0x70,0xa2,0x98,0x45,0xed,0x08,0x4e,0x15,0xbc,0x16,0xb8,0x0f,0x5c,0xb7,0x02,0x8c,0x5b,0x67,0x60,0xc4,0x8a,0x78,0x98,0x9f,0x47,0x8d,0x34,0xda,0xa6,0xac,0x15,0x83,0x88,0x0e,0x4f,0x06,0xf2,0x2a,0x56,0x4f,0xab,0xd0,0x5a,0x82,0xd4,0x51,0x68,0x5d,0x4a,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0x47,0x95,0x45,0xe8,0xda,0x76,0x0f,0x77,0x61,0xcb,0x97,0xf7,0x64,0x09,0xeb,0x56,0x10,0x06,0xd0,0xc9,0x0e,0xd1,0x83,0x6e,0x6f,0x80,0xa3,0xcf,0xdf,0x64,0xf2,0x30,0x20,0xb0,0x01,0x5f,0xbc,0xef,0x02,0xb0,0x57,0xff,0x5a,0x54,0xe2,0xe1,0x5b,0x03,0x69,0x82,0x75,0x1b,0x07,0xa2,0xc9,0x74,0x28,0x19,0xef,0x39,0x15,0xd6,0x94,0xbd,0x51,0xdd,0x50,0x03,0xd1,0x50,0x54,0x0e,0x84,0x42,0x51,0x0d,0x54,0x2c,0x1c,0x50,0xb5,0x60,0x24,0x99,0x8c,0x06,0x63,0x4a,0xc8,0x38,0x8d,0x38,0x7a,0xa8,0x34,0x36,0x33,0x99,0x8f,0x5b,0x03,0xd4,0xee,0x43,0x9c,0x9d,0x8f,0xf7,0xcc,0x8f,0x2a,0x2a,0x0c,0xe4,0x27,0xa7,0x13,0xa5,0x62,0x35,0x3f,0x5b,0x65,0xc1,0x32,0x58,0x47,0xf3,0xe5,0x4a,0xa1,0x54,0xc4,0xad,0xc9,0x34,0x6e,0x67,0x46,0x27,0xf3,0x41,0x35,0xde,0x13,0x8c,0x05,0x55,0x55,0x95,0x65,0xae,0x90,0x18,0x3a,0x18,0xef,0x31,0x62,0x86,0x1e,0x0e,0x6b,0xc1,0x70,0xcc,0x0d,0x94,0x26,0x87,0xf5,0x78,0x4f,0x52,0x4d,0xca,0x11,0x23,0x12,0x0e,0x47,0x22,0x11,0x1b,0x28,0x39,0x98,0x88,0xf7,0xe8,0xba,0x1e,0x93,0xf7,0xc6,0x12,0x29,0x25,0x96,0x64,0xc8,0x06,0x0a,0xda,0x7d,0x5f,0x1e,0x28,0x55,0xaa,0x92,0x31,0x5b,0xcd,0x17,0xc7,0xf2,0x65,0xe9,0x50,0x71,0xbc,0xf4,0x95,0x76,0xdf,0xce,0x01,0x28,0xe4,0xa4,0xc4,0x4f,0x05,0xa3,0x41,0x35,0x19,0x09,0xc9,0x81,0x44,0x2a,0x26,0x07,0x14,0x25,0x91,0x0a,0x44,0x8d,0x50,0x30,0x20,0xcb,0x9a,0x9c,0x88,0x29,0x8a,0x2c,0x87,0xb5,0xd3,0xfb,0x8f,0xea,0xc6,0xfe,0xbb,0xad,0x64,0x4b,0xf2,0x48,0xa9,0xfc,0xb5,0xca,0xb4,0x99,0xcb,0x43,0xa0,0x35,0x0e,0x71,0x35,0xdc,0x2b,0x31,0x14,0x55,0x8d,0xf5,0x4a,0xe1,0x48,0xb0,0x57,0xfa,0xaf,0xa7,0x87,0x7b,0x27,0xc5,0x92,0xf1,0xa9,0x6f,0x81,0xef,0x95,0xdb,0x2c,0xe7,0x3f,0x00,0x00,0x00,0xff,0xff}; the data len compressed is 0x90a, the data len uncompressed is 0x1c00. when I call uncompress like this: uncompress(destbuf, &destlen, srcbuf, srclen); // destlen is 0x1c00, srclen is 0x90a the return value is Z_BUF_ERROR which means destbuf too small; but in fact the uncompression succeeded. and then when I call uncompress with larger dest buf: uncompress(destbuf,&destlen, srcbuf, srclen); // destlen is 0x1c01, and no other change the return value is Z_DATA_ERROR which means the input data was corrupted or incomplete. I'm using the newst version of zlib.

baosj0 commented 1 year ago

I step into the zlib src code,

            if (stream.avail_out == 0) {

            stream.avail_out = left > (uLong)max ? max : (uInt)left;

            left -= stream.avail_out;

        }

        if (stream.avail_in == 0) {

            stream.avail_in = len > (uLong)max ? max : (uInt)len;

            len -= stream.avail_in;

        }

        err = inflate(&stream, Z_NO_FLUSH);

    } while (err == Z_OK);

the first time calling inflate, all data has been uncompressed, the err is Z_OK; the second time calling inflate, the avail_out and avail_in is all zero, then the return value is z_buf_error.

madler commented 1 year ago

That is an incomplete zlib stream. It's fine as far as it goes, but it ends before ever having a last deflate block or a zlib trailer. It appears to have been deliberately cut off using Z_SYNC_FLUSH, since it ends with an empty, non-last stored block.