tev icon indicating copy to clipboard operation
tev copied to clipboard

tev crashes with pgm files that contain comments

Open vchizhov opened this issue 6 years ago • 4 comments

If I have comments # some comment here in a pgm file, tev crashes upon trying to open it. It works fine with pgm files not containing comments however.

vchizhov avatar Jan 15 '20 09:01 vchizhov

Hi there! Thanks for letting me know. Can you provide sample files for me to test? Ideally, one PGM without a comment that works and another one with a comment that doesn't work.

Tom94 avatar Jan 15 '20 09:01 Tom94

You can find two images here: https://drive.google.com/open?id=1xIhlVBwbFfgehWgAO-7YHJ_YgsgUeZ1x The _no_comment image is exactly the same as the other, but with the comments removed. Both work fine in IrfanView on Windows and xv on Linux.

vchizhov avatar Jan 15 '20 12:01 vchizhov

Thanks for the images!

It appears that stb_image, the underlying library responsible for loading PGM images, does not support comments---see here. Unfortunately, I can't do much about that until I maybe get some time to implement my own PGM decoder---which doesn't actually look extremely involved. Best bet is to create an issue over at the stb_image repo.

That said, tev really should handle this more gracefully... stb_image gives tev a 0x0 image upon trying to load the PGM, which leads to a crash. This is something I'll definitely address.

Tom94 avatar Jan 15 '20 15:01 Tom94

Thank you for looking into it. I submitted an issue with stb, hopefully that gets handled (unfortunately my current workload does not allow me the time to go and fix it myself), since I am also using stb_image in some probjects.

vchizhov avatar Jan 15 '20 17:01 vchizhov