Mageia Bugzilla – Attachment 8566 Details for
Bug 19571
overflow when querying for size with urpmq
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
[patch]
(get_int2) try new 64bit tag else old 32bit tag
0004-get_int2-try-new-64bit-tag-else-old-32bit-tag.patch (text/plain), 1.81 KB, created by
Thierry Vignaud
on 2016-10-18 03:48:36 CEST
(
hide
)
Description:
(get_int2) try new 64bit tag else old 32bit tag
Filename:
MIME Type:
Creator:
Thierry Vignaud
Created:
2016-10-18 03:48:36 CEST
Size:
1.81 KB
patch
obsolete
>From 9512de0eef8d934878a18c90288886d21444863b Mon Sep 17 00:00:00 2001 >From: Thierry Vignaud <thierry.vignaud@gmail.com> >Date: Tue, 18 Oct 2016 03:42:32 +0200 >Subject: [PATCH 4/4] (get_int2) try new 64bit tag else old 32bit tag > >thus enabling to report size of >4Gb packages (however insane this is) >--- > URPM.xs | 15 ++++++++++++--- > 1 file changed, 12 insertions(+), 3 deletions(-) > >diff --git a/URPM.xs b/URPM.xs >index e633fa8..7ef336c 100644 >--- a/URPM.xs >+++ b/URPM.xs >@@ -214,8 +214,17 @@ get_int(const Header header, rpmTag tag) { > } > > static uint64_t >+get_int2(const Header header, rpmTag newtag, rpmTag oldtag) { >+ struct rpmtd_s val; >+ >+ if (!headerGet(header, newtag, &val, HEADERGET_DEFAULT)) >+ headerGet(header, oldtag, &val, HEADERGET_DEFAULT); >+ return rpmtdGetNumber(&val); >+} >+ >+static uint64_t > get_filesize(const Header h) { >- return headerGetNumber(h, RPMTAG_SIGSIZE) + 440; /* 440 is the rpm header size (?) empirical, but works */ >+ return get_int2(h, RPMTAG_LONGSIGSIZE, RPMTAG_SIGSIZE) + 440; /* 440 is the rpm header size (?) empirical, but works */ > } > > static int >@@ -762,7 +771,7 @@ pack_header(const URPM__Package pkg) { > const char *nvr = headerGetAsString(pkg->h, RPMTAG_NVR); > const char *arch = get_arch(pkg->h); > p += 1 + snprintf(buff, sizeof(buff), "%s.%s@%llu@%llu@%s", nvr, arch, >- get_int(pkg->h, RPMTAG_EPOCH), get_int(pkg->h, RPMTAG_SIZE), >+ get_int(pkg->h, RPMTAG_EPOCH), get_int2(pkg->h, RPMTAG_LONGSIZE, RPMTAG_SIZE), > get_name(pkg->h, RPMTAG_GROUP)); > pkg->info = memcpy(malloc(p-buff), buff, p-buff); > } >@@ -1770,7 +1779,7 @@ Pkg_size(pkg) > } else > RETVAL = 0; > } else if (pkg->h) >- RETVAL = get_int(pkg->h, RPMTAG_SIZE); >+ RETVAL = get_int2(pkg->h, RPMTAG_LONGSIZE, RPMTAG_SIZE); > else > RETVAL = 0; > OUTPUT: >-- >2.10.1 >
From 9512de0eef8d934878a18c90288886d21444863b Mon Sep 17 00:00:00 2001 From: Thierry Vignaud <thierry.vignaud@gmail.com> Date: Tue, 18 Oct 2016 03:42:32 +0200 Subject: [PATCH 4/4] (get_int2) try new 64bit tag else old 32bit tag thus enabling to report size of >4Gb packages (however insane this is) --- URPM.xs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/URPM.xs b/URPM.xs index e633fa8..7ef336c 100644 --- a/URPM.xs +++ b/URPM.xs @@ -214,8 +214,17 @@ get_int(const Header header, rpmTag tag) { } static uint64_t +get_int2(const Header header, rpmTag newtag, rpmTag oldtag) { + struct rpmtd_s val; + + if (!headerGet(header, newtag, &val, HEADERGET_DEFAULT)) + headerGet(header, oldtag, &val, HEADERGET_DEFAULT); + return rpmtdGetNumber(&val); +} + +static uint64_t get_filesize(const Header h) { - return headerGetNumber(h, RPMTAG_SIGSIZE) + 440; /* 440 is the rpm header size (?) empirical, but works */ + return get_int2(h, RPMTAG_LONGSIGSIZE, RPMTAG_SIGSIZE) + 440; /* 440 is the rpm header size (?) empirical, but works */ } static int @@ -762,7 +771,7 @@ pack_header(const URPM__Package pkg) { const char *nvr = headerGetAsString(pkg->h, RPMTAG_NVR); const char *arch = get_arch(pkg->h); p += 1 + snprintf(buff, sizeof(buff), "%s.%s@%llu@%llu@%s", nvr, arch, - get_int(pkg->h, RPMTAG_EPOCH), get_int(pkg->h, RPMTAG_SIZE), + get_int(pkg->h, RPMTAG_EPOCH), get_int2(pkg->h, RPMTAG_LONGSIZE, RPMTAG_SIZE), get_name(pkg->h, RPMTAG_GROUP)); pkg->info = memcpy(malloc(p-buff), buff, p-buff); } @@ -1770,7 +1779,7 @@ Pkg_size(pkg) } else RETVAL = 0; } else if (pkg->h) - RETVAL = get_int(pkg->h, RPMTAG_SIZE); + RETVAL = get_int2(pkg->h, RPMTAG_LONGSIZE, RPMTAG_SIZE); else RETVAL = 0; OUTPUT: -- 2.10.1
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 19571
:
8522
|
8523
|
8525
|
8528
|
8529
|
8530
|
8531
|
8537
|
8538
|
8539
|
8541
|
8542
|
8543
|
8547
|
8548
|
8549
|
8563
|
8564
|
8565
| 8566