segmentation fault when decoding with webcam
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
QR Tools |
Fix Released
|
Medium
|
Unassigned |
Bug Description
Hi all,
When trying to decode wifi codes with my webcam, qtqr crashes with the following output:
Traceback (most recent call last):
File "/usr/bin/qtqr", line 723, in decodeWebcam
if qr.data_
File "/usr/lib/
'wifi' : lambda data: re.findall(
IndexError: list index
After a little investigation I found out that my smartphone generates the qr codes, which I try to scan, incorrectly. Instead of two semicolons the MeCard like format ends with only one semicolon.
Thus, the regex-expression yields no result and the indexing with [0] fails.
As a fix I would suggest to put "qr.data_
and show an error box including the undecodable string if there was an IndexError.
Any ideas/comments on that?
Related branches
- Ramiro Algozino: Approve
-
Diff: 37 lines (+18/-7)1 file modifiedqtqr.py (+18/-7)
Changed in qr-tools: | |
status: | New → Fix Committed |
importance: | Undecided → Medium |
Changed in qr-tools: | |
status: | Fix Committed → Fix Released |
milestone: | none → 2.2 |
Hi!
Thanks for the report. I agree that the regex is failing and then making the app crash. I think that the right way would be to wrap all the decoders in a try-catch and just fallback to show the decoded text. I wouldn’t touch the regex because the QR code is malformed.
Feel free to send a PR!
Ramiro Algozino /algozino. com.ar/ decode[ qr.data_ type](qr. data) == 'NULL': python2. 7/dist- packages/ qrtools. py", line 92, in <lambda> u"WIFI: S:(.*); T:(.*); P:(.*); ;", data, re.IGNORECASE)[0], decode[ qr.data_ type](qr. data)" into a try/except block /bugs.launchpad .net/bugs/ 1909309 decode[ qr.data_ type](qr. data) == 'NULL': python2. 7/dist- packages/ qrtools. py", line 92, in <lambda> u"WIFI: S:(.*); T:(.*); P:(.*); ;", data, re.IGNORECASE)[0], decode[ qr.data_ type](qr. data)" into a try/except block /bugs.launchpad .net/qr- tools/+ bug/1909309/ +subscriptions
https:/
On 25 Dec 2020, 10:25 +0100, Niko Zurstraßen <email address hidden>, wrote:
> Public bug reported:
>
> Hi all,
>
> When trying to decode wifi codes with my webcam, qtqr crashes with the
> following output:
>
> Traceback (most recent call last):
> File "/usr/bin/qtqr", line 723, in decodeWebcam
> if qr.data_
> File "/usr/lib/
> 'wifi' : lambda data: re.findall(
> IndexError: list index
>
>
> After a little investigation I found out that my smartphone generates the qr codes, which I try to scan, incorrectly. Instead of two semicolons the MeCard like format ends with only one semicolon.
> Thus, the regex-expression yields no result and the indexing with [0] fails.
>
> As a fix I would suggest to put "qr.data_
> and show an error box including the undecodable string if there was an IndexError.
>
> Any ideas/comments on that?
>
> ** Affects: qr-tools
> Importance: Undecided
> Status: New
>
> --
> You received this bug notification because you are a member of QR Tools
> Team, which is subscribed to QR Tools.
> https:/
>
> Title:
> segmentation fault when decoding with webcam
>
> Status in QR Tools:
> New
>
> Bug description:
> Hi all,
>
> When trying to decode wifi codes with my webcam, qtqr crashes with the
> following output:
>
> Traceback (most recent call last):
> File "/usr/bin/qtqr", line 723, in decodeWebcam
> if qr.data_
> File "/usr/lib/
> 'wifi' : lambda data: re.findall(
> IndexError: list index
>
>
> After a little investigation I found out that my smartphone generates the qr codes, which I try to scan, incorrectly. Instead of two semicolons the MeCard like format ends with only one semicolon.
> Thus, the regex-expression yields no result and the indexing with [0] fails.
>
> As a fix I would suggest to put "qr.data_
> and show an error box including the undecodable string if there was an IndexError.
>
> Any ideas/comments on that?
>
> To manage notifications about this bug go to:
> https:/