Efficient-Compression-Tool
Efficient-Compression-Tool copied to clipboard
Access violation in merge.h in windows release build only
Hi, I've got some png images here that repeatably crash a windows release build of ECT, but are processed fine by a debug build. They crash at line 83 of merge.h in zopfli at the while statement:
/* The remaining few bytes. */ while (scan != end && *scan == *match) { scan++; match++; }
I've been able to see that periodically the variable scan is equal to end+1 at the first call of the GetMatch function, and so the access violation occurs when it goes to access then memory at scan. I changed the above lines to:
while (scan < end && *scan == *match) { scan++; match++; }
which seems to make the problem go away, but without knowing what the issue is, I cannot say whether this is a safe patch.
Any thoughts?
Jay
Sounds like something to be investigated – can you attach an image where the problem occurs?