Menu

#190 Aztec - Buffer over run

1.0
closed
Git Lost
None
2020-05-01
2020-04-21
Milton Neal
No

Hi all,

In lines 1159 and 1269 in Aztec.c, the indexer 'i' will end up larger than the length of 'binary_string'.
Although this is fixed by placing the null terminator at the end of the valid data of 'adjusted_string', I think this should be corrected.
My suggested fix at lines 1159 & 1269.
I have tested this and works fine.
.
.
if (i < data_length) {
adjusted_string[j] = binary_string[i];
j++;
i++;
}
} while (i < data_length);
.
.

Cheers Milton

Discussion

  • Robin Stuart

    Robin Stuart - 2020-04-26

    Hi Milton,

    Thank you for this report - I don't know how the code ended up like this, but it seems unnecessarily complicated. I have replaced this section with a for loop which I think is much easier to understand, uses less memory and avoids this problem. Please let me know if you are happy with this solution.

    Robin.

     
  • Milton Neal

    Milton Neal - 2020-04-28

    Hi Robin, tried your solution and found that some my test data would not generate barcodes that would scan correctly. I reverted back to the original code and ran my test data again and all was ok.
    So currently i'm trying to figure out where the problems lies in your updated code. I'll get back to you when i find the issue. In the mean time maybe you can check it out your end.
    Thanks Milton

     
  • Git Lost

    Git Lost - 2020-04-28

    Hi Milton, Robin, I noticed this while looking at #191 as the test suite fails. Basically new code counting B bits instead of B-1 bits I think. We do MR now...

     
  • Milton Neal

    Milton Neal - 2020-04-30

    Hello Robin, Martin
    Tested the lastest fix (B-1) and all my test data works fine including HIBC and GS1 data.
    Thanks for your work.
    Milton

     
  • Git Lost

    Git Lost - 2020-05-01

    Thanks very much Milton.

     
  • Git Lost

    Git Lost - 2020-05-01
    • status: open --> closed
     

Log in to post a comment.