From 54464bd3832f82c27f96ea2df892088b5b63fa81 Mon Sep 17 00:00:00 2001 From: Brian Ben Maranville Date: Thu, 18 Feb 2021 14:32:53 -0500 Subject: [PATCH] fixing read errors on object headers v2 - was not tracking continuation blocks properly, or skipping the signature on the continuation blocks --- esm/dataobjects.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/esm/dataobjects.js b/esm/dataobjects.js index 8566097..9ce4292 100644 --- a/esm/dataobjects.js +++ b/esm/dataobjects.js @@ -353,6 +353,8 @@ export class DataObjects { _parse_v2_objects(buf, offset) { /* Parse a collection of version 2 Data Objects. */ + // NOTE: this is using absolute address even for messages in continuation + // blocks, and not keeping a concatenated message block (unlike pyfive) var [header, creation_order_size, block_offset] = this._parse_v2_header(buf, offset); offset = block_offset; @@ -365,7 +367,7 @@ export class DataObjects { var local_offset = 0; while (true) { - if (local_offset >= block_size) { + if (local_offset >= block_size - HEADER_MSG_INFO_V2_SIZE) { let next_block = object_header_blocks[++current_block]; if (next_block == null) { break @@ -378,7 +380,8 @@ export class DataObjects { msg.set('offset_to_message', offset_to_message); if (msg.get('type') == OBJECT_CONTINUATION_MSG_TYPE) { var [fh_off, size] = struct.unpack_from('