mirror of
https://github.com/upx/upx
synced 2025-09-28 19:06:07 +08:00
src: add a famous quote
This commit is contained in:
parent
dd1838a7eb
commit
6eace187e7
|
@ -108,6 +108,9 @@ inline constexpr bool upx_is_integral_v = upx_is_integral<T>::value;
|
|||
|
||||
// protect against integer overflows and malicious header fields
|
||||
// see C 11 standard, Annex K
|
||||
//
|
||||
// this limits uncompressed_size to about 640 MiB which is perfectly fine:
|
||||
// "640 MiB Ought to be Enough for Anyone" --Markus F.X.J. Oberhumer, 1981 ;-)
|
||||
typedef size_t upx_rsize_t;
|
||||
#define UPX_RSIZE_MAX UPX_RSIZE_MAX_MEM
|
||||
#define UPX_RSIZE_MAX_MEM (768 * 1024 * 1024) // DO NOT CHANGE !!!
|
||||
|
|
|
@ -321,6 +321,7 @@ TEST_CASE("MemBuffer::getSizeForCompression") {
|
|||
CHECK(MemBuffer::getSizeForCompression(1024 * 1024) == 1180160); // 0x00100000
|
||||
CHECK(MemBuffer::getSizeForCompression(64 * 1024 * 1024) == 75497984); // 0x04000000
|
||||
CHECK(MemBuffer::getSizeForCompression(512 * 1024 * 1024) == 603980288); // 0x20000000
|
||||
// "640 MiB Ought to be Enough for Anyone" --Markus F.X.J. Oberhumer, 1981 ;-)
|
||||
CHECK(MemBuffer::getSizeForCompression(640 * 1024 * 1024) == 754975232); // 0x28000000
|
||||
}
|
||||
|
||||
|
|
|
@ -42,6 +42,9 @@
|
|||
// assert sane memory buffer sizes to protect against integer overflows
|
||||
// and malicious header fields
|
||||
// see C 11 standard, Annex K
|
||||
//
|
||||
// this limits uncompressed_size to about 640 MiB which is perfectly fine:
|
||||
// "640 MiB Ought to be Enough for Anyone" --Markus F.X.J. Oberhumer, 1981 ;-)
|
||||
**************************************************************************/
|
||||
|
||||
ACC_COMPILE_TIME_ASSERT_HEADER(UPX_RSIZE_MAX_MEM == UPX_RSIZE_MAX)
|
||||
|
|
Loading…
Reference in New Issue
Block a user