NaturalHistoryMuseum / pyzbar

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

Error: double free or corruption (!prev) #83

Open kaili211 opened 3 years ago

kaili211 commented 3 years ago

Hi, I got the double free or corruption (!prev) error when I was decoding this image. I don't know how to solve it, can you help me? Here are my codes:

import cv2
from pyzbar import pyzbar

img = cv2.imread(img)
h, w, _ = img.shape
gray_image = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
barcodes = pyzbar.decode(gray_image)

My python version is 3.7.3 and the version of pyzbar is 0.1.8.

Thanks.

liyaodev commented 3 years ago

Hi, I also met a similar problem. Have you solved it again? this image

kaili211 commented 3 years ago

Not yet. My solution is to decode each image in different processes, so if one crashed others won't be affected. But of course, it will cost more running time.

liyaodev commented 3 years ago

export MALLOC_CHECK_=0, I found it here I suggest you try it.

kaili211 commented 3 years ago

Thank you. But the same problem still exists for me.

PetrPy commented 2 years ago

I have run into the same issue. It makes Pyzbar unusable.

winnosuge commented 1 year ago

I also got the same issue.

sizhky commented 1 year ago

+1

DaikiTanak commented 3 months ago

We have the same error.

By enabling faulthandler.enable(), the following logs appeared.

Fatal Python error: Aborted
Current thread 0x00007fe908226740 (most recent call first):
File "/usr/local/lib/python3.9/site-packages/pyzbar/pyzbar.py", line 230 in decode
Fatal Python error: Segmentation fault

It seems that some errors are inside wrapper.zbar_scan_image(). https://github.com/NaturalHistoryMuseum/pyzbar/blob/ff2892666fa7cd305f0a95f9808159809c6fc222/pyzbar/pyzbar.py#L230

Just FYI: