You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi authors, this issue I found is CRITICAL, please take some time and make quick response to enhance reliability.
I found the potential bug from _zbar_image_copy function in zbar/image.h (line 158 -> 172):
inti, len=src->datalen;
long*sp= (void*)src->data, *dp= (void*)dst->data;
char*spc, *dpc;
/* Do it word per word, in order to speedup */for (i=0; i<len; i+=sizeof(long))
*dp++= ~(*sp++);
// (1): i is now larger or equal to len (i >= len)/* Deal with non-aligned remains, if any */len-=i; // (2): from (1) => (len <= 0)spc= (char*)sp;
dpc= (char*)dp;
for (i=0; i<len; i++) //(3): from (2) => this loop will never be executed*dpc++= ~(*spc++);
The for loop to /* Deal with non-aligned remains, if any */ will never be executed since the loop above /* Do it word per word, in order to speedup */ make an additional of i += sizeof(long) right before exit the loop, this will result in i >= len in every situation. The loop to /* Deal with non-aligned remains, if any */ will never run because of the described behaviour.
May I create a PR to fix this ?
Thank you.
The text was updated successfully, but these errors were encountered:
Hi authors, this issue I found is CRITICAL, please take some time and make quick response to enhance reliability.
I found the potential bug from _zbar_image_copy function in zbar/image.h (line 158 -> 172):
The for loop to
/* Deal with non-aligned remains, if any */
will never be executed since the loop above/* Do it word per word, in order to speedup */
make an additional ofi += sizeof(long)
right before exit the loop, this will result ini >= len
in every situation. The loop to/* Deal with non-aligned remains, if any */
will never run because of the described behaviour.May I create a PR to fix this ?
Thank you.
The text was updated successfully, but these errors were encountered: