fix signature header writing if the archive size is bigger than 2G
OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=429
This commit is contained in:
parent
969ff309fb
commit
c47faa21d4
66
bigarchive.diff
Normal file
66
bigarchive.diff
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
--- lib/signature.c.orig 2018-01-05 10:59:06.358348915 +0000
|
||||||
|
+++ lib/signature.c 2018-01-05 12:25:13.224472739 +0000
|
||||||
|
@@ -118,6 +118,8 @@ rpmRC rpmGenerateSignature(char *SHA256,
|
||||||
|
char *reservedSpace;
|
||||||
|
int spaceSize = 32; /* always reserve a bit of space */
|
||||||
|
int gpgSize = rpmExpandNumeric("%{__gpg_reserved_space}");
|
||||||
|
+ rpm_off_t size32 = size;
|
||||||
|
+ rpm_off_t payloadSize32 = payloadSize;
|
||||||
|
|
||||||
|
/* Prepare signature */
|
||||||
|
if (SHA256) {
|
||||||
|
@@ -149,21 +151,32 @@ rpmRC rpmGenerateSignature(char *SHA256,
|
||||||
|
|
||||||
|
rpmtdReset(&td);
|
||||||
|
td.count = 1;
|
||||||
|
- if (payloadSize < UINT32_MAX) {
|
||||||
|
- rpm_off_t p = payloadSize;
|
||||||
|
- rpm_off_t s = size;
|
||||||
|
- td.type = RPM_INT32_TYPE;
|
||||||
|
+ td.type = RPM_INT32_TYPE;
|
||||||
|
|
||||||
|
- td.tag = RPMSIGTAG_PAYLOADSIZE;
|
||||||
|
- td.data = &p;
|
||||||
|
- headerPut(sig, &td, HEADERPUT_DEFAULT);
|
||||||
|
+ td.tag = RPMSIGTAG_PAYLOADSIZE;
|
||||||
|
+ td.data = &payloadSize32;
|
||||||
|
+ headerPut(sig, &td, HEADERPUT_DEFAULT);
|
||||||
|
|
||||||
|
- td.tag = RPMSIGTAG_SIZE;
|
||||||
|
- td.data = &s;
|
||||||
|
- headerPut(sig, &td, HEADERPUT_DEFAULT);
|
||||||
|
- } else {
|
||||||
|
+ td.tag = RPMSIGTAG_SIZE;
|
||||||
|
+ td.data = &size32;
|
||||||
|
+ headerPut(sig, &td, HEADERPUT_DEFAULT);
|
||||||
|
+
|
||||||
|
+ if (payloadSize >= UINT32_MAX) {
|
||||||
|
+ /*
|
||||||
|
+ * Put the 64bit size variants into the header, but
|
||||||
|
+ * modify spaceSize so that the resulting header has
|
||||||
|
+ * the same size. Note that this only works if
|
||||||
|
+ * RPMSIGTAG_RESERVEDSPACE is the last tag in the header!
|
||||||
|
+ */
|
||||||
|
rpm_loff_t p = payloadSize;
|
||||||
|
rpm_loff_t s = size;
|
||||||
|
+ int newsigSize, oldsigSize;
|
||||||
|
+
|
||||||
|
+ oldsigSize = headerSizeof(sig, HEADER_MAGIC_YES);
|
||||||
|
+
|
||||||
|
+ headerDel(sig, RPMSIGTAG_PAYLOADSIZE);
|
||||||
|
+ headerDel(sig, RPMSIGTAG_SIZE);
|
||||||
|
+
|
||||||
|
td.type = RPM_INT64_TYPE;
|
||||||
|
|
||||||
|
td.tag = RPMSIGTAG_LONGARCHIVESIZE;
|
||||||
|
@@ -174,8 +187,8 @@ rpmRC rpmGenerateSignature(char *SHA256,
|
||||||
|
td.data = &s;
|
||||||
|
headerPut(sig, &td, HEADERPUT_DEFAULT);
|
||||||
|
|
||||||
|
- /* adjust for the size difference between 64- and 32bit tags */
|
||||||
|
- spaceSize -= 8;
|
||||||
|
+ newsigSize = headerSizeof(sig, HEADER_MAGIC_YES);
|
||||||
|
+ spaceSize -= newsigSize - oldsigSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gpgSize > 0)
|
@ -1,3 +1,10 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Jan 5 13:26:50 CET 2018 - mls@suse.de
|
||||||
|
|
||||||
|
- fix signature header writing if the archive size is bigger
|
||||||
|
than 2 GByte
|
||||||
|
new patch: bigarchive.diff
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue Jan 2 11:04:52 CET 2018 - mls@suse.de
|
Tue Jan 2 11:04:52 CET 2018 - mls@suse.de
|
||||||
|
|
||||||
|
3
rpm.spec
3
rpm.spec
@ -133,6 +133,7 @@ Patch106: transfiletriggerpostun.diff
|
|||||||
Patch107: hardlink.diff
|
Patch107: hardlink.diff
|
||||||
Patch108: debugedit-macro.diff
|
Patch108: debugedit-macro.diff
|
||||||
Patch109: pythondistdeps.diff
|
Patch109: pythondistdeps.diff
|
||||||
|
Patch110: bigarchive.diff
|
||||||
Patch6464: auto-config-update-aarch64-ppc64le.diff
|
Patch6464: auto-config-update-aarch64-ppc64le.diff
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
#
|
#
|
||||||
@ -229,7 +230,7 @@ rm -f rpmdb/db.h
|
|||||||
%patch -P 85
|
%patch -P 85
|
||||||
%patch -P 93 -P 94 -P 99
|
%patch -P 93 -P 94 -P 99
|
||||||
%patch -P 100 -P 102 -P 103 -P 104 -P 105 -P 106 -P 107 -P 108
|
%patch -P 100 -P 102 -P 103 -P 104 -P 105 -P 106 -P 107 -P 108
|
||||||
%patch -P 109
|
%patch -P 109 -P 110
|
||||||
|
|
||||||
%ifarch aarch64 ppc64le
|
%ifarch aarch64 ppc64le
|
||||||
%patch6464
|
%patch6464
|
||||||
|
Loading…
Reference in New Issue
Block a user