xdelta3-djw.h (xdelta3-3.0.10) | : | xdelta3-djw.h (xdelta3-3.0.11) | ||
---|---|---|---|---|
skipping to change at line 1458 | skipping to change at line 1458 | |||
if (bits >= min_clen && code <= limit[bits]) { goto done; } | if (bits >= min_clen && code <= limit[bits]) { goto done; } | |||
} | } | |||
while (bstate->cur_mask != 0x100); | while (bstate->cur_mask != 0x100); | |||
next_byte: | next_byte: | |||
if (*input == input_end) | if (*input == input_end) | |||
{ | { | |||
stream->msg = "secondary decoder end of input"; | stream->msg = "secondary decoder end of input"; | |||
return XD3_INTERNAL; | return XD3_INVALID_INPUT; | |||
} | } | |||
bstate->cur_byte = *(*input)++; | bstate->cur_byte = *(*input)++; | |||
bstate->cur_mask = 1; | bstate->cur_mask = 1; | |||
} | } | |||
done: | done: | |||
if (base[bits] <= code) | if (base[bits] <= code) | |||
{ | { | |||
skipping to change at line 1481 | skipping to change at line 1481 | |||
if (offset <= max_sym) | if (offset <= max_sym) | |||
{ | { | |||
IF_DEBUG2 (DP(RINT "(j) %u ", code)); | IF_DEBUG2 (DP(RINT "(j) %u ", code)); | |||
*sym = inorder[offset]; | *sym = inorder[offset]; | |||
return 0; | return 0; | |||
} | } | |||
} | } | |||
corrupt: | corrupt: | |||
stream->msg = "secondary decoder invalid code"; | stream->msg = "secondary decoder invalid code"; | |||
return XD3_INTERNAL; | return XD3_INVALID_INPUT; | |||
} | } | |||
static int | static int | |||
djw_decode_clclen (xd3_stream *stream, | djw_decode_clclen (xd3_stream *stream, | |||
bit_state *bstate, | bit_state *bstate, | |||
const uint8_t **input, | const uint8_t **input, | |||
const uint8_t *input_end, | const uint8_t *input_end, | |||
uint8_t *cl_inorder, | uint8_t *cl_inorder, | |||
usize_t *cl_base, | usize_t *cl_base, | |||
usize_t *cl_limit, | usize_t *cl_limit, | |||
skipping to change at line 1608 | skipping to change at line 1608 | |||
/* Remove the RUN_1 MTF offset. */ | /* Remove the RUN_1 MTF offset. */ | |||
mtf -= 1; | mtf -= 1; | |||
s = 0; | s = 0; | |||
} | } | |||
} | } | |||
/* If (rep != 0) there were too many codes received. */ | /* If (rep != 0) there were too many codes received. */ | |||
if (rep != 0) | if (rep != 0) | |||
{ | { | |||
stream->msg = "secondary decoder invalid repeat code"; | stream->msg = "secondary decoder invalid repeat code"; | |||
return XD3_INTERNAL; | return XD3_INVALID_INPUT; | |||
} | } | |||
return 0; | return 0; | |||
} | } | |||
static inline int | static inline int | |||
djw_decode_prefix (xd3_stream *stream, | djw_decode_prefix (xd3_stream *stream, | |||
bit_state *bstate, | bit_state *bstate, | |||
const uint8_t **input, | const uint8_t **input, | |||
const uint8_t *input_end, | const uint8_t *input_end, | |||
skipping to change at line 1656 | skipping to change at line 1656 | |||
usize_t groups, gp; | usize_t groups, gp; | |||
usize_t output_bytes = (usize_t)(output_end - output); | usize_t output_bytes = (usize_t)(output_end - output); | |||
usize_t sector_size; | usize_t sector_size; | |||
usize_t sectors; | usize_t sectors; | |||
int ret; | int ret; | |||
/* Invalid input. */ | /* Invalid input. */ | |||
if (output_bytes == 0) | if (output_bytes == 0) | |||
{ | { | |||
stream->msg = "secondary decoder invalid input"; | stream->msg = "secondary decoder invalid input"; | |||
return XD3_INTERNAL; | return XD3_INVALID_INPUT; | |||
} | } | |||
/* Decode: number of groups */ | /* Decode: number of groups */ | |||
if ((ret = xd3_decode_bits (stream, & bstate, & input, | if ((ret = xd3_decode_bits (stream, & bstate, & input, | |||
input_end, DJW_GROUP_BITS, & groups))) | input_end, DJW_GROUP_BITS, & groups))) | |||
{ | { | |||
goto fail; | goto fail; | |||
} | } | |||
groups += 1; | groups += 1; | |||
skipping to change at line 1798 | skipping to change at line 1798 | |||
XD3_ASSERT (gp < groups); | XD3_ASSERT (gp < groups); | |||
gp_inorder = inorder[gp]; | gp_inorder = inorder[gp]; | |||
gp_base = base[gp]; | gp_base = base[gp]; | |||
gp_limit = limit[gp]; | gp_limit = limit[gp]; | |||
gp_minlen = minlen[gp]; | gp_minlen = minlen[gp]; | |||
gp_maxlen = maxlen[gp]; | gp_maxlen = maxlen[gp]; | |||
} | } | |||
XD3_ASSERT (output_end - output > 0); | if (output_end < output) | |||
{ | ||||
stream->msg = "secondary decoder invalid input"; | ||||
return XD3_INVALID_INPUT; | ||||
} | ||||
/* Decode next sector. */ | /* Decode next sector. */ | |||
n = xd3_min (sector_size, (usize_t) (output_end - output)); | n = xd3_min (sector_size, (usize_t) (output_end - output)); | |||
do | do | |||
{ | { | |||
usize_t sym; | usize_t sym; | |||
if ((ret = djw_decode_symbol (stream, & bstate, | if ((ret = djw_decode_symbol (stream, & bstate, | |||
& input, input_end, | & input, input_end, | |||
End of changes. 5 change blocks. | ||||
5 lines changed or deleted | 9 lines changed or added |