1
0
mirror of https://git.tukaani.org/xz.git synced 2026-10-31 03:14:56 +00:00

liblzma: Add internal constant INDEX_RECORDS_MAX

It's the theoretical maximum number of Records that fit in a .xz file.
This can be used to reject obviously wrong values.
This commit is contained in:
Lasse Collin 2026-06-03 00:05:48 +03:00
parent 25a53ed6d1
commit 9ff4dadca9
No known key found for this signature in database
GPG Key ID: 38EE757D69184620

View File

@ -26,6 +26,12 @@
/// Maximum Unpadded Size /// Maximum Unpadded Size
#define UNPADDED_SIZE_MAX (LZMA_VLI_MAX & ~LZMA_VLI_C(3)) #define UNPADDED_SIZE_MAX (LZMA_VLI_MAX & ~LZMA_VLI_C(3))
/// Maximum number of Records if all sizes fit in one byte:
/// Index Indicator (1) + Number of Records (5) + List of Records + CRC32 (4)
/// Larger value isn't possible because then the Index would grow larger than
/// what Backward Size in Stream Footer can encode (2^34 bytes).
#define INDEX_RECORDS_MAX ((LZMA_BACKWARD_SIZE_MAX - 1 - 5 - 4) / 2)
/// Index Indicator based on xz specification /// Index Indicator based on xz specification
#define INDEX_INDICATOR 0 #define INDEX_INDICATOR 0