aboutsummaryrefslogtreecommitdiff
path: root/linux/lib/xz/xz_stream.h
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2009-04-27 11:26:09 +0300
committerLasse Collin <lasse.collin@tukaani.org>2009-04-27 11:26:09 +0300
commit6ffa14f3b019919dd7c8d3a768606c05f87fe729 (patch)
tree0dc042b8445eb7f1502a056dc02a13999596f678 /linux/lib/xz/xz_stream.h
parent6cb1a9a62fb75707f0255b9e59569d6eac498b57 (diff)
downloadxz-embedded-6ffa14f3b019919dd7c8d3a768606c05f87fe729.tar.gz
Define VLI_BYTES_MAX macro and use it in dec_vli().
This makes it possible to use uint32_t as vli_type. Doing so risks having some integer overflows unless the caller can ensure that the total amounts of input and output will stay below 256 MiB.
Diffstat (limited to 'linux/lib/xz/xz_stream.h')
-rw-r--r--linux/lib/xz/xz_stream.h3
1 files changed, 3 insertions, 0 deletions
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