diff options
Diffstat (limited to 'linux')
-rw-r--r-- | linux/lib/xz/xz_dec_stream.c | 5 | ||||
-rw-r--r-- | linux/lib/xz/xz_stream.h | 3 |
2 files changed, 5 insertions, 3 deletions
diff --git a/linux/lib/xz/xz_dec_stream.c b/linux/lib/xz/xz_dec_stream.c index 96e8736..af878c4 100644 --- a/linux/lib/xz/xz_dec_stream.c +++ b/linux/lib/xz/xz_dec_stream.c @@ -189,10 +189,9 @@ static enum xz_ret XZ_FUNC dec_vli(struct xz_dec *s, return XZ_STREAM_END; } - if (s->pos >= 56) - return XZ_DATA_ERROR; - s->pos += 7; + if (s->pos == 7 * VLI_BYTES_MAX) + return XZ_DATA_ERROR; } return XZ_OK; diff --git a/linux/lib/xz/xz_stream.h b/linux/lib/xz/xz_stream.h index de35e67..bb70b09 100644 --- a/linux/lib/xz/xz_stream.h +++ b/linux/lib/xz/xz_stream.h @@ -40,4 +40,7 @@ typedef uint64_t vli_type; #define VLI_MAX ((vli_type)-1 / 2) #define VLI_UNKNOWN ((vli_type)-1) +/* Maximum encoded size of a VLI */ +#define VLI_BYTES_MAX (sizeof(vli_type) * 8 / 7) + #endif |