Crash in ReadBarcodes with ImageFormat::RGBA #796
-
I downloaded and compiled the master branch using MSVC 2022 on May 26. Using the example code from zxing-cpp/example , a crash occurs with the attached image. The memory address pointed to by "src" in ZXing::SetupLumImageView is not valid. ZXing::SetupLumImageView::__l14::(const unsigned char * src) Line 115 C++ I noted that stbi_load() returns that the image contains transparency information (4 channels). If I change the image format from ImageFormat::RGBA to ImageFormat::RGB, there is no crash. Can anyone else reproduce this crash? Am I doing something wrong? Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I could not reproduce any memory access issue with ASAN on Linux. Since you closed the discussion you seem to have found the cause yourself? May I ask what it was? |
Beta Was this translation helpful? Give feedback.
My apologies as it turned out to be my mistake. When calling stbi_load, I was passing in a value of 3 for desired channels and not 0 as the example code does. This caused it to return only RGB (24bits per pixel) data. However, ImageFormat::RGBA (30bits per pixel) was then used to construct the ImageView which caused it to read past the buffer returned by stbi_load.