Efficient-Compression-Tool icon indicating copy to clipboard operation
Efficient-Compression-Tool copied to clipboard

Access violation in merge.h in windows release build only

Open jstavats opened this issue 2 years ago • 1 comments
trafficstars

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

jstavats avatar Jul 13 '23 17:07 jstavats

Sounds like something to be investigated – can you attach an image where the problem occurs?

fhanau avatar Jul 28 '23 14:07 fhanau