dlbeer/quirc

Crashes on quirc_end

Closed this issue · 3 comments

Hello, I am trying to use this library on a ESP32 (with esp32-camera), but quirc_end seems to not work properly.

Some specs:

Platform: ESP32 (esp-idf)
quirc version: june 30 master
(but also tried an older version with same results)
Using 320x240 grayscale images

My code

[ .... code that creates 'fb' with 'fb->buf' being image data, and uses quirc resize ]
int buf_w, buf_h;
image = quirc_begin(q, &buf_w, &buf_h);
// Fill image buffer
assert fb->len == buf_w * buf_h
memcpy(image, fb->buf, fb->len);
// End
printf("quirc_end\n");
quirc_end(q);

printf("quirc_count\n");
int id_count = quirc_count(q);
[ .... rest, but never reached ]

The code crashes somewhere is quirc_end in the 'finder_scan' part of it.
(which I know because I edited (the middle of) it like this:

pixels_setup(q, threshold);
printf("Pixel setup finished\n");
for (i = 0; i < q->h; i++)
	finder_scan(q, i);
printf("Finder Scan finished\n");

Output

Running this code does not work, but surprisingly has 2 possible crashes:

Either:

[ startup and other output ]
quirc_end
Pixel setup finished
??╔╔f79ba24b1b7a80baad9b3f8917a3b7d4aef4185de9f8cf9ef7c4eedaf23aa610╔??╔lC?PY??╔3ffcd9dcPY??╔3ffb0140lC?PY??╔4008789dPY??╔3ffb0200lC?PY??╔40087ae5PY??╔3ffb0220lC?PY??╔40084d0dPY??╔
3ffb0240lC?PY??╔40084e41PY??╔3ffb0270lC?PY??╔400da452PY??╔3ffb0290lC?PY??╔400d584dPY??╔3ffb0550lC?PY??╔400d57e8PY??╔3ffb05a0lC?PY??╔4008a6cePY??╔3ffb05d0lC?PY??╔4008ae9dPY?
?╔3ffb0600lC?PY??╔4008b75bPY??╔3ffb0620lC?PY??╔4008c64dPY??╔3ffb0640lC?PY??╔4008466aPY??╔3ffb0650lC?PY??╔400e603dPY??╔3ffb2090lC?PY??╔400e6cf4PY??╔3ffb20e0lC?PY??╔400d56b9PY
??╔3ffb2100lC?PY??╔400d54e8PY??╔3ffb5380lC?PY??╔400d1200PY??╔3ffb53a0lC?PY??╔4008b66dPY??╔3ffb53c0╔╔Rebootin╔
[ ESP32 reboots ]

Or:

[ startup and other output ]
quirc_end
Pixel setup finished
h@?i 1p?? ╔assertion "%s" failed: file "%s", line %d%s%s
)& 1 reg*h@?i 1p?? ╔h@?i 1p?? ╔h@?i 1p?? ╔h@?i 1p?? ╔assertion "%s" failed: file "%s", line %d%s%s
)& 1 reg*h@?i 1p?? ╔assertion "%s" failed: file "%s", line %d%s%s
)& 1 reg*h@?i 1p?? ╔assertion "%s" failed: file "%s", line %d%s%s
[ ... last line keeps repeating about 500 times ]
)& 1 reg*h@?i 1p?? ╔assertion "%s" failed: file "%s", line %d%s%s
)& 1 reg*h@?i 1p?? ╔assertion "%s" failed: file "%s", line %d%s%s
)& 1 reg*╔h@?i 1p?? ╔╔╔╔P ?P ?P ?P ?P ?P ?P ?@p ? ?@?|? 1p?? ╔@p ? ?@?|? 1p?? ╔
[ ESP32 stops giving output (but does not restart or anything) ]

Notice how "Pixel setup finished" is always outputted, while "Finder Scan finished" is not.

I would greatly appreciate any help

Hello @KoenduBuf,

Failing in different ways can hint an Undefined Behaviour. This UB could be triggered either by (1) your code or (2) the quirc library (as you suggest).

Could you provide the full ESP32 program code and/or one (or more) image(s) triggering the issue? We need the code for (1) and an image for (2) in order to help you.

I'm sorry for the inconvenience, after some other weird behavior I replaced the ESP32 for a different one on a hunch which resolved (among others) this issue, I guess it was a hardware problem. Thank you for the response.

No worries, closing this issue then :)