Mageia Bugzilla – Attachment 8538 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]
64bit support for ->filesize()
filesize64.diff (text/plain), 1.06 KB, created by
Thierry Vignaud
on 2016-10-15 05:31:32 CEST
(
hide
)
Description:
64bit support for ->filesize()
Filename:
MIME Type:
Creator:
Thierry Vignaud
Created:
2016-10-15 05:31:32 CEST
Size:
1.06 KB
patch
obsolete
>diff -u ./URPM.xs ./URPM.xs >--- ./URPM.xs 2016-10-15 04:49:34.517918398 +0200 >+++ ./URPM.xs 2016-10-15 04:49:34.517918398 +0200 >@@ -46,7 +46,7 @@ > > struct s_Package { > Header h; >- int filesize; >+ uint64_t filesize; > unsigned flag; > char *info; > char *requires; >@@ -217,9 +217,9 @@ > return rpmtdGetNumber(&val); > } > >-static size_t >+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 >@@ -1055,7 +1055,7 @@ > // reset package, next line will be for another one > memset(pkg, 0, sizeof(struct s_Package)); > } else if (!strcmp(tag, "filesize")) >- pkg->filesize = atoi(data); >+ pkg->filesize = atoll(data); > else { > char **ptr = NULL; > if (!strcmp(tag, "requires")) >@@ -1791,7 +1791,7 @@ > PPCODE: > pkg->filesize = filesize; > >-int >+long > Pkg_filesize(pkg) > URPM::Package pkg > CODE:
diff -u ./URPM.xs ./URPM.xs --- ./URPM.xs 2016-10-15 04:49:34.517918398 +0200 +++ ./URPM.xs 2016-10-15 04:49:34.517918398 +0200 @@ -46,7 +46,7 @@ struct s_Package { Header h; - int filesize; + uint64_t filesize; unsigned flag; char *info; char *requires; @@ -217,9 +217,9 @@ return rpmtdGetNumber(&val); } -static size_t +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 @@ -1055,7 +1055,7 @@ // reset package, next line will be for another one memset(pkg, 0, sizeof(struct s_Package)); } else if (!strcmp(tag, "filesize")) - pkg->filesize = atoi(data); + pkg->filesize = atoll(data); else { char **ptr = NULL; if (!strcmp(tag, "requires")) @@ -1791,7 +1791,7 @@ PPCODE: pkg->filesize = filesize; -int +long Pkg_filesize(pkg) URPM::Package pkg CODE:
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