ImageProcessing-ElectronicPublications / photoquick

Light-weight image viewer with crop,resize,collage, photogrid and filters
GNU General Public License v3.0
4 stars 0 forks source link

Threshold -> Export to PDF -> segment fault #16

Closed zvezdochiot closed 4 years ago

zvezdochiot commented 4 years ago

Hi @ksharindam .

New bug.

(Threshold or GrayScale->Threshold Bimod (2, 0)) -> Export to PDF -> segment fault

Threshold BG Scale (8, 0) -> Export to PDF -> :+1:

ksharindam commented 4 years ago

it is working fine in my system.

zvezdochiot commented 4 years ago

Hi @ksharindam .

Hmm. I'll try gdb.

(gdb) r
Starting program: /home/zvezdochiot/WORK/soft/git/ImageProcessing-ElectronicPublications/photoquick-tt/src/photoquick 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/i386-linux-gnu/i686/cmov/libthread_db.so.1".
[New Thread 0xb4a53b70 (LWP 10562)]
[New Thread 0xb40ffb70 (LWP 10563)]
[Thread 0xb4a53b70 (LWP 10562) exited]
[Thread 0xb40ffb70 (LWP 10563) exited]
[New Thread 0xb40ffb70 (LWP 10568)]
[New Thread 0xb4a53b70 (LWP 10569)]
[New Thread 0xb2fd8b70 (LWP 10570)]

Program received signal SIGSEGV, Segmentation fault.
getPngIdat (rawdata=0x83e4600 "\211PNG\r\n\032\n", rawdata_size=50040) at pdfwriter.cpp:200
200         read32(size, data); // chunk size
(gdb) 

PS: photoquick.pro:

...
QMAKE_CXXFLAGS = -g -fopenmp -std=c++11
QMAKE_LFLAGS +=
...
ksharindam commented 4 years ago

maybe a bug for all monochrome image. even Threshold->Export to PDF may rise this issue.

zvezdochiot commented 4 years ago

Hi @ksharindam .

Threshold BG Scale does not cause a problem, see https://github.com/ImageProcessing-ElectronicPublications/photoquick/issues/16#issue-651003286 .

ksharindam commented 4 years ago

getPngIdat() can cause segfault only if the png data is incomplete or invalid

ksharindam commented 4 years ago

You have changed some code. compile the code from current repository without any modifications and then check if segfault occurs.

zvezdochiot commented 4 years ago

Hi @ksharindam .

Current:

(gdb) r
Starting program: /home/zvezdochiot/WORK/soft/git/ImageProcessing-ElectronicPublications/photoquick-t3/src/photoquick 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/i386-linux-gnu/i686/cmov/libthread_db.so.1".
[New Thread 0xb4a53b70 (LWP 428)]
[New Thread 0xb40ffb70 (LWP 429)]
[Thread 0xb4a53b70 (LWP 428) exited]
[Thread 0xb40ffb70 (LWP 429) exited]
[New Thread 0xb40ffb70 (LWP 445)]
[New Thread 0xb4a53b70 (LWP 446)]
[New Thread 0xb2fd8b70 (LWP 447)]

Program received signal SIGSEGV, Segmentation fault.
getPngIdat (rawdata=0x83f6d88 "\211PNG\r\n\032\n", rawdata_size=50040) at pdfwriter.cpp:198
198         read32(size, data); // chunk size
(gdb) 
ksharindam commented 4 years ago

The main problem is that i can not reproduce this bug. So it is difficult to track.

On Sun, 5 Jul, 2020, 5:09 PM звездочёт, notifications@github.com wrote:

Hi @ksharindam https://github.com/ksharindam .

Current:

(gdb) r Starting program: /home/mykaralw/WORK/soft/git/ImageProcessing-ElectronicPublications/photoquick-t3/src/photoquick [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/i386-linux-gnu/i686/cmov/libthread_db.so.1". [New Thread 0xb4a53b70 (LWP 428)] [New Thread 0xb40ffb70 (LWP 429)] [Thread 0xb4a53b70 (LWP 428) exited] [Thread 0xb40ffb70 (LWP 429) exited] [New Thread 0xb40ffb70 (LWP 445)] [New Thread 0xb4a53b70 (LWP 446)] [New Thread 0xb2fd8b70 (LWP 447)]

Program received signal SIGSEGV, Segmentation fault. getPngIdat (rawdata=0x83f6d88 "\211PNG\r\n\032\n", rawdata_size=50040) at pdfwriter.cpp:198198 read32(size, data); // chunk size (gdb)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ImageProcessing-ElectronicPublications/photoquick/issues/16#issuecomment-653877793, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEKWXPUIRRNROYDP6PSMHHDR2BQ5PANCNFSM4OQWSULA .

zvezdochiot commented 4 years ago

Ok. Maybe the original image will help:

page0001

Threshold -> Export to PDF -> segment fault

ksharindam commented 4 years ago

Put some qDebug() in the getPngDat and see at which position of data it is trying to read before segfault.

On Sun, 5 Jul, 2020, 5:14 PM Arindam Chaudhuri, ksharindam@gmail.com wrote:

The main problem is that i can not reproduce this bug. So it is difficult to track.

On Sun, 5 Jul, 2020, 5:09 PM звездочёт, notifications@github.com wrote:

Hi @ksharindam https://github.com/ksharindam .

Current:

(gdb) r Starting program: /home/mykaralw/WORK/soft/git/ImageProcessing-ElectronicPublications/photoquick-t3/src/photoquick [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/i386-linux-gnu/i686/cmov/libthread_db.so.1". [New Thread 0xb4a53b70 (LWP 428)] [New Thread 0xb40ffb70 (LWP 429)] [Thread 0xb4a53b70 (LWP 428) exited] [Thread 0xb40ffb70 (LWP 429) exited] [New Thread 0xb40ffb70 (LWP 445)] [New Thread 0xb4a53b70 (LWP 446)] [New Thread 0xb2fd8b70 (LWP 447)]

Program received signal SIGSEGV, Segmentation fault. getPngIdat (rawdata=0x83f6d88 "\211PNG\r\n\032\n", rawdata_size=50040) at pdfwriter.cpp:198198 read32(size, data); // chunk size (gdb)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ImageProcessing-ElectronicPublications/photoquick/issues/16#issuecomment-653877793, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEKWXPUIRRNROYDP6PSMHHDR2BQ5PANCNFSM4OQWSULA .

ksharindam commented 4 years ago

Only this image, some specific images or any image in your system?

On Sun, 5 Jul, 2020, 5:17 PM звездочёт, notifications@github.com wrote:

Ok. Maybe the original image will help:

[image: page0001] https://user-images.githubusercontent.com/12370082/86531936-506bbd80-bece-11ea-847b-e0d877373cfd.jpg

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ImageProcessing-ElectronicPublications/photoquick/issues/16#issuecomment-653878654, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEKWXPUL4FGMIRI6KLRYLJDR2BR57ANCNFSM4OQWSULA .

zvezdochiot commented 4 years ago

Hi @ksharindam .

Gdb clearly says that segfault happens on line 198: https://github.com/ImageProcessing-ElectronicPublications/photoquick/blob/550b518d93321ee0ab01d0435639377156b50253/src/pdfwriter.cpp#L198

ksharindam commented 4 years ago

Yes, but does using any image cause the segfault, or that specific image?

On Sun, 5 Jul, 2020, 5:22 PM звездочёт, notifications@github.com wrote:

Hi @ksharindam https://github.com/ksharindam .

Gdb clearly says that segfault happens on line 198:

https://github.com/ImageProcessing-ElectronicPublications/photoquick/blob/550b518d93321ee0ab01d0435639377156b50253/src/pdfwriter.cpp#L198

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ImageProcessing-ElectronicPublications/photoquick/issues/16#issuecomment-653879146, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEKWXPUP2DTCVG5TTDGJ6SLR2BSQBANCNFSM4OQWSULA .

zvezdochiot commented 4 years ago

Hmm. So far, only on this.

ksharindam commented 4 years ago

Ok

On Sun, 5 Jul, 2020, 5:28 PM звездочёт, notifications@github.com wrote:

Hmm. So far, only on this.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ImageProcessing-ElectronicPublications/photoquick/issues/16#issuecomment-653879776, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEKWXPUOL5Q5FIES56URYI3R2BTHNANCNFSM4OQWSULA .

ksharindam commented 4 years ago

I have downloaded that image and applied... Threshold -> Export to PDF GrayScale -> Bimodal Threshold -> Export to PDF Threshold -> Bimodal Threshold -> Export to PDF But segfault did not happen. Here is the pdf output. 86531936-506bbd80-bece-11ea-847b-e0d877373cfd.pdf

zvezdochiot commented 4 years ago

Hi @ksharindam .

:ballot_box_with_check: Hmm. So I have Thread naughty. To know the problem is purely my system.