Skip to content

Commit

Permalink
Support for 0x17 byte code (fmp12)
Browse files Browse the repository at this point in the history
  • Loading branch information
evanmiller committed Feb 10, 2021
1 parent ebe4166 commit 47d336b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
14 changes: 10 additions & 4 deletions HACKING
Original file line number Diff line number Diff line change
Expand Up @@ -255,12 +255,12 @@ Simple data
2 5 Value (Bytes)

Offset Length Value
0 1 0x10
1 3 Value (Bytes)
0 1 0x10 <= C <= 0x11
1 3+(C-0x10) Value (Bytes)

Offset Length Value
0 1 0x11 <= C <= 0x15
1 2*(C-0x10)+1 Value (Bytes)
0 1 0x12 <= C <= 0x15
1 1+2*(C-0x10) Value (Bytes)

Offset Length Value
0 1 (0x19 | 0x23)
Expand Down Expand Up @@ -316,6 +316,12 @@ Long key-value
4 1 N = Length (Integer)
5 N Value (Bytes)

Offset Length Value
0 1 0x17
1 3 Key (Bytes)
4 2 N = Length (Integer)
6 N Value (Bytes)

Offset Length Value
0 1 0x1E
1 1 K = Key Length (Integer)
Expand Down
15 changes: 15 additions & 0 deletions src/block.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,21 @@ static fmp_error_t process_block_v7(fmp_block_t *block) {
chunk->data.len = *p++;
chunk->data.bytes = p;
p += chunk->data.len;
} else if (c == 0x17) {
chunk->type = FMP_CHUNK_FIELD_REF_LONG;
p++;
chunk->ref_long.bytes = p;
chunk->ref_long.len = 3;
p += chunk->ref_long.len;
if (p + 2 > end) {
retval = FMP_ERROR_DATA_EXCEEDS_SECTOR_SIZE;
free(chunk);
break;
}
chunk->data.len = copy_int(p, 2);
p += 2;
chunk->data.bytes = p;
p += chunk->data.len;
} else if (c >= 0x19 && c <= 0x1D) {
chunk->type = FMP_CHUNK_DATA_SIMPLE;
p++;
Expand Down

0 comments on commit 47d336b

Please sign in to comment.