Uncompress C# DeflateStream compressed buffer using rom\miniz

zedrummer
Posts: 2
Joined: Wed Apr 13, 2022 4:03 pm

Uncompress C# DeflateStream compressed buffer using rom\miniz

Postby zedrummer » Thu Jan 19, 2023 6:21 pm

Hello

I have on a PC a 12288-byte buffer that has been compressed with the C# DeflateStream class, so generating a raw deflate data buffer.
I send the compressed data to an ESP32 via serial COM. To uncompress, I would like to use rom/miniz using this code in a function:

Code: Select all

  tinfl_decompressor inflator;
  tinfl_init(&inflator);
  tinfl_status status = tinfl_decompress(&inflator, panel2, &inBufferSize, pBuffer, pBuffer, &outBufferSize, 0);
  if (status != TINFL_STATUS_DONE) return false;
pBuffer is pointing to a 12288+100-byte buffer allocated with malloc successfully.
When I run the program, the ESP32 reboots at tinfl_decompress (no crash if I comment the 2 lines with the status).
- I have checked the transfer, the buffer is correct.
- I have tried with TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF as flag (as the destination buffer should be enough for the whole uncompressed data)

But still, it crashes.
Something I'm doing wrong? Are there any further initialisations for miniz to perform before the code above?

Thanks
David

Who is online

Users browsing this forum: No registered users and 97 guests