kanryu / quickviewer

A image/comic viewer application for Windows, Mac and Linux, it can show images very fast
https://kanryu.github.io/quickviewer/
GNU General Public License v3.0
536 stars 63 forks source link

Crash with 2269x4594 JPEG file #102

Closed ijuhs closed 5 years ago

ijuhs commented 5 years ago

Hi.

Opening this image crashes a QuickViewer process in Windows 7. 2019-04-24

I tried to debug by myself and found in ResizeHalf\ResizeHalf\reduceby2_functions.h:89 that crashes occur when variables are width = 2268, x = 2264.

I don't know the algorithm at all but it looks like the memory boundary issue. So, I changed the line for (size_t x = 0; x < width - 2; x += 8) { to for (size_t x = 0; x < width - 4; x += 8) { and this works.

I just report it to help you find the real problem/solution behind it.

Thank you.

kanryu commented 5 years ago

Thank you for testing QuickViewer. Unfortunately, the bug you reported does not reproduce on my PC. The image is displayed correctly with QuickViewer-1.1.4-x64.

If the width of the image is not a multiple of four, all handling constraints occur.

If you pointed out the 89th line you pointed out, the 55th line may need the same correction. However, this function reduceby2_hv_rgba () may not be used because the image you provided is a 24bpp JPEG?

ijuhs commented 5 years ago

Sorry for partial reporting. I had tested the QuickViewer-1.1.4-x86. And now I tried the x64 version and found no problems.

I built a x86 debug version to debug but the version also worked perfectly. And then I tried a release version without optimizations but it crashes as the downloaded QuickViewer-1.1.4-x86 without any configurations.

I thought this is really weird but the fix worked. The fact that the function is not supposed to be called means stack corruption or so. It can be my hardware problem.

Thank you.

kanryu commented 5 years ago

After trying with QuickViewer-1.1.4-x86, the image could not be displayed as you pointed out.

The fix you provided will probably not handle the right edge of the image correctly, but the impact on the entire image will be minor.

Due to the mechanics of this application, this fault has to be tested on both RGB888 and RGBA8888. Gray8 is automatically converted to RGB888. GrayA88 is automatically converted to RGBA8888.

kanryu commented 5 years ago

I made it.