uzlib icon indicating copy to clipboard operation
uzlib copied to clipboard

UZLIB_CONF_USE_MEMCPY option bug

Open udovichenkoAlexander opened this issue 1 year ago • 1 comments

memcpy cannot be used, because memory region may overlap (the behavior is undefined). copy must be made byte by byte.

Simple check with tgunzip:

  1. set UZLIB_CONF_USE_MEMCPY to 1
  2. set OUT_CHUNK_SIZE to 1024
  3. do not use ring buffer
  4. try decopress simple text file (12341234123411111113333333). I attach test.gz
  5. tgunzip return Error during decompression: -4 (TINF_CHKSUM_ERROR)

test.txt test.gz

udovichenkoAlexander avatar Jun 07 '24 07:06 udovichenkoAlexander

Thanks for the report and testcase. Apparently, needs to be replaced by memmove(). Sadly, I don't have enough resource to work on the project now, so that will have to wait.

pfalcon avatar Jun 23 '24 07:06 pfalcon