|
|
5523e9 |
From 89e6317c75b494905590903fadbfdc3c8d31e2b8 Mon Sep 17 00:00:00 2001
|
|
|
5523e9 |
From: Stefan Berger <stefanb@us.ibm.com>
|
|
|
5523e9 |
Date: Fri, 29 Apr 2016 07:09:49 -0400
|
|
|
5523e9 |
Subject: [PATCH] Extend header size to 256MB due to file signatures
|
|
|
5523e9 |
|
|
|
5523e9 |
Extend the header size to 256MB in case an RPM has a lot of files
|
|
|
5523e9 |
and the file signatures do not fit within the current limit of 16MB.
|
|
|
5523e9 |
|
|
|
5523e9 |
An example for an RPM with many files is kcbench-data-4.0. It contains
|
|
|
5523e9 |
more than 52000 files. With each signature with a 2048 bit key requiring
|
|
|
5523e9 |
256 bytes plus a preamble, its representation in text from, and other
|
|
|
5523e9 |
overhead, the size of the header (index length and data length) exceeds
|
|
|
5523e9 |
32Mb.
|
|
|
5523e9 |
|
|
|
5523e9 |
If this particular RPM's files have been signed using this patch, older
|
|
|
5523e9 |
versions of the rpm tool will report the header being too large. So this
|
|
|
5523e9 |
failure is expected then.
|
|
|
5523e9 |
|
|
|
5523e9 |
By setting the limit to 256MB we create a lot of room for the future.
|
|
|
5523e9 |
|
|
|
5523e9 |
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
|
|
|
5523e9 |
---
|
|
|
5523e9 |
lib/header.c | 2 +-
|
|
|
5523e9 |
lib/header_internal.h | 5 +++--
|
|
|
5523e9 |
2 files changed, 4 insertions(+), 3 deletions(-)
|
|
|
5523e9 |
|
|
|
5523e9 |
diff --git a/lib/header.c b/lib/header.c
|
|
|
5523e9 |
index 81f2038..7f7c115 100644
|
|
|
5523e9 |
--- a/lib/header.c
|
|
|
5523e9 |
+++ b/lib/header.c
|
|
|
5523e9 |
@@ -99,7 +99,7 @@ struct headerToken_s {
|
|
|
5523e9 |
/** \ingroup header
|
|
|
5523e9 |
* Maximum no. of bytes permitted in a header.
|
|
|
5523e9 |
*/
|
|
|
5523e9 |
-static const size_t headerMaxbytes = (32*1024*1024);
|
|
|
5523e9 |
+static const size_t headerMaxbytes = (256*1024*1024);
|
|
|
5523e9 |
|
|
|
5523e9 |
#define INDEX_MALLOC_SIZE 8
|
|
|
5523e9 |
|
|
|
5523e9 |
diff --git a/lib/header_internal.h b/lib/header_internal.h
|
|
|
5523e9 |
index bbe2097..aed3977 100644
|
|
|
5523e9 |
--- a/lib/header_internal.h
|
|
|
5523e9 |
+++ b/lib/header_internal.h
|
|
|
5523e9 |
@@ -45,9 +45,10 @@ struct indexEntry_s {
|
|
|
5523e9 |
|
|
|
5523e9 |
/**
|
|
|
5523e9 |
* Sanity check on data size and/or offset and/or count.
|
|
|
5523e9 |
- * This check imposes a limit of 16 MB, more than enough.
|
|
|
5523e9 |
+ * This check imposes a limit of 256 MB -- file signatures
|
|
|
5523e9 |
+ * may require a lot of space in the header.
|
|
|
5523e9 |
*/
|
|
|
5523e9 |
-#define HEADER_DATA_MAX 0x00ffffff
|
|
|
5523e9 |
+#define HEADER_DATA_MAX 0x0fffffff
|
|
|
5523e9 |
#define hdrchkData(_nbytes) ((_nbytes) & (~HEADER_DATA_MAX))
|
|
|
5523e9 |
|
|
|
5523e9 |
/**
|
|
|
5523e9 |
--
|
|
|
5523e9 |
2.9.5
|
|
|
5523e9 |
|