NaturalHistoryMuseum / pyzbar

Read one-dimensional barcodes and QR codes from Python 2 and 3.
MIT License
718 stars 175 forks source link

Come across a corner case when decoding image cause core dump #158

Open zwsjink opened 9 months ago

zwsjink commented 9 months ago

The error shows like this :

python3: /build/zbar-m079fX/zbar-0.10+doc/zbar/qrcode/qrdectxt.c:368: qr_code_data_list_extract_text: Assertion `next > syms->datalen' failed. Aborted (core dumped)

when I'm doing experiment with a bunch of pictures, some case failed constantly:

corner_case

The code goes like this:

from PIL import Image
from pyzbar.pyzbar import decode
image = Image.open(image_path)
image = image.convert('L')
qr_codes = decode(image)
print(len(qr_codes))