NaturalHistoryMuseum / pylibdmtx

Read Data Matrix barcodes from Python 2 and 3.
MIT License
147 stars 56 forks source link

This image causes datamatrix decode to hard crash #62

Open raylutz opened 3 years ago

raylutz commented 3 years ago

I found I had to wrap the pylibdmtx in an external subprocess (i.e. copy the source image to a file and then have a CLI envoked script that calls pylibdmtx and writes the result to a file) because this image causes everything to just hard stop, with no error messages or exceptions raised. I always treasure this sort of test data because it should be fairly easy for someone familiar with the code to fix the problem, but it isn't something I have the knowledge to do.

datamatrix_temp_09992_00008_000024_0

Enjoy!

tusharj333 commented 3 years ago

Hi, @raylutz Did you find any fix for this issue?

tyctor commented 3 years ago

hi i have image example, that causes hard crash of python script it cant be handled in try: except block

invalid_dmtx

raylutz commented 2 years ago

Hi, @raylutz Did you find any fix for this issue?

No, the datamatrix code still crashes, but by wrapping it in a subprocess, it will not cause the calling program to crash. Try/Except block does not work in this example. I don't know the datamatrix code well enough to propose a change. But of course we can do a better job of clipping out the correct region and avoid the issue altogether.

MathijsNL commented 2 years ago

Interesting find.

Using the library (dmtxread) also crashes, so the problem lies in the lib and not in the wrapper.

+++ exited with 40 +++

Adding a 10 pixel white border seems to fix the issue. Maybe someone more experienced with C code can shed light on this?