Menu

#188 Possible bug in Grid Matrix

1.0
closed
None
2020-04-06
2020-04-03
Milton Neal
No

Possible bug in gridmtx.c
Function:
add_byte_count() in lines 229 to 232
/ Add the length indicator for byte encoded blocks /
static void add_byte_count(char binary[], const size_t byte_count_posn, const int byte_count) {
bin_append_posn(byte_count - 1, 9, binary, byte_count_posn);
}

In line 231: I don 't think byte_count should be decremented by 1 as it indicates how many byte encoded blocks there are.
Can you check this for me.
Thanks Milton

Discussion

  • Git Lost

    Git Lost - 2020-04-03

    Hi Milton, yes it's off-putting but it's part of the standard AIMD014 (v 1.63) section 6.3.7:

    The 8-bit binary data set contains all 8-bit values from 0 to 255. Binary data can be encoded in groups up to 512 bytes. Each group is preceded by a 9-bit run length.

    For example: Let L be the number of bytes of input data to be encoded in the 8-bit binary data set. First output (L-1) as a 9-bit binary prefix to record the number of bytes, and then output the L 8-bit binary data bytes, followed by a type conversion code from Table 9.

    So it makes sense that to fit numbers 1-512 into 9 bits one is subtracted.

     
  • Milton Neal

    Milton Neal - 2020-04-04

    Hi GitLost
    Thanks for the insight.
    Can close this ticket.

     
  • Git Lost

    Git Lost - 2020-04-04

    Thanks Milton, will add a comment documenting it, appreciate the reports, Martin

     
  • Robin Stuart

    Robin Stuart - 2020-04-06
    • status: open --> closed
     

Log in to post a comment.