Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions src/fstapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -5086,10 +5086,11 @@ static int fstReaderParseChainTable(unsigned char *chain_cmem,

if (shval > 0) {
pval = chain_table[idx] = pval + shval;
if (idx) {
if (have_physical_chain) {
chain_table_lengths[pidx] = pval - chain_table[pidx];
}
pidx = idx++;
have_physical_chain = 1;
} else if (shval < 0) {
chain_table[idx] =
0; /* need to explicitly zero as calloc above might not run */
Expand All @@ -5112,7 +5113,9 @@ static int fstReaderParseChainTable(unsigned char *chain_cmem,
}

for (i = 0; i < loopcnt; i++) {
chain_table[idx++] = 0;
chain_table[idx] = 0;
chain_table_lengths[idx] = 0;
idx++;
}
}

Expand Down Expand Up @@ -5145,10 +5148,11 @@ static int fstReaderParseChainTable(unsigned char *chain_cmem,
}

pval = chain_table[idx] = pval + (val >> 1);
if (idx) {
if (have_physical_chain) {
chain_table_lengths[pidx] = pval - chain_table[pidx];
}
pidx = idx++;
have_physical_chain = 1;
} else {
fstHandle loopcnt = val >> 1;

Expand All @@ -5157,7 +5161,9 @@ static int fstReaderParseChainTable(unsigned char *chain_cmem,
}

for (i = 0; i < loopcnt; i++) {
chain_table[idx++] = 0;
chain_table[idx] = 0;
chain_table_lengths[idx] = 0;
idx++;
}
}

Expand All @@ -5170,7 +5176,8 @@ static int fstReaderParseChainTable(unsigned char *chain_cmem,
/* the entry the room check kept back, so that the last chain a length was
written to is as long as the distance from it to the end of the data */
chain_table[idx] = vc_len;
chain_table_lengths[pidx] = chain_table[idx] - chain_table[pidx];
if (have_physical_chain)
chain_table_lengths[pidx] = chain_table[idx] - chain_table[pidx];

for (i = 0; i < idx; i++) {
int32_t v32 = chain_table_lengths[i];
Expand Down Expand Up @@ -5272,6 +5279,8 @@ int fstReaderIterBlocks2(fstReaderContext *ctx,
uint32_t *tc_head = NULL;
uint32_t tc_head_items = 0;
traversal_mem_offs = 0;
int have_physical_chain = 0;
pidx = 0; /* current section only */

fstReaderFseeko(xc, xc->f, blkpos, SEEK_SET);

Expand Down
Loading