summaryrefslogtreecommitdiff
path: root/xdelta3/xdelta3-djw.h
diff options
context:
space:
mode:
Diffstat (limited to 'xdelta3/xdelta3-djw.h')
-rw-r--r--xdelta3/xdelta3-djw.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/xdelta3/xdelta3-djw.h b/xdelta3/xdelta3-djw.h
index 080de59..f69cb1d 100644
--- a/xdelta3/xdelta3-djw.h
+++ b/xdelta3/xdelta3-djw.h
@@ -1456,7 +1456,7 @@ djw_decode_symbol (xd3_stream *stream,
1456 if (*input == input_end) 1456 if (*input == input_end)
1457 { 1457 {
1458 stream->msg = "secondary decoder end of input"; 1458 stream->msg = "secondary decoder end of input";
1459 return XD3_INTERNAL; 1459 return XD3_INVALID_INPUT;
1460 } 1460 }
1461 1461
1462 bstate->cur_byte = *(*input)++; 1462 bstate->cur_byte = *(*input)++;
@@ -1479,7 +1479,7 @@ djw_decode_symbol (xd3_stream *stream,
1479 1479
1480 corrupt: 1480 corrupt:
1481 stream->msg = "secondary decoder invalid code"; 1481 stream->msg = "secondary decoder invalid code";
1482 return XD3_INTERNAL; 1482 return XD3_INVALID_INPUT;
1483} 1483}
1484 1484
1485static int 1485static int
@@ -1606,7 +1606,7 @@ djw_decode_1_2 (xd3_stream *stream,
1606 if (rep != 0) 1606 if (rep != 0)
1607 { 1607 {
1608 stream->msg = "secondary decoder invalid repeat code"; 1608 stream->msg = "secondary decoder invalid repeat code";
1609 return XD3_INTERNAL; 1609 return XD3_INVALID_INPUT;
1610 } 1610 }
1611 1611
1612 return 0; 1612 return 0;
@@ -1654,7 +1654,7 @@ xd3_decode_huff (xd3_stream *stream,
1654 if (output_bytes == 0) 1654 if (output_bytes == 0)
1655 { 1655 {
1656 stream->msg = "secondary decoder invalid input"; 1656 stream->msg = "secondary decoder invalid input";
1657 return XD3_INTERNAL; 1657 return XD3_INVALID_INPUT;
1658 } 1658 }
1659 1659
1660 /* Decode: number of groups */ 1660 /* Decode: number of groups */
@@ -1796,7 +1796,11 @@ xd3_decode_huff (xd3_stream *stream,
1796 gp_maxlen = maxlen[gp]; 1796 gp_maxlen = maxlen[gp];
1797 } 1797 }
1798 1798
1799 XD3_ASSERT (output_end - output > 0); 1799 if (output_end < output)
1800 {
1801 stream->msg = "secondary decoder invalid input";
1802 return XD3_INVALID_INPUT;
1803 }
1800 1804
1801 /* Decode next sector. */ 1805 /* Decode next sector. */
1802 n = xd3_min (sector_size, (usize_t) (output_end - output)); 1806 n = xd3_min (sector_size, (usize_t) (output_end - output));