diff --git a/0001-bplist-Fix-offset-table-range-check-do-not-rely-on-pointer-overflow.patch b/0001-bplist-Fix-offset-table-range-check-do-not-rely-on-pointer-overflow.patch deleted file mode 100644 index 1c9b7ef36c7d1547dfd30fc851de5e29382f35d2..0000000000000000000000000000000000000000 --- a/0001-bplist-Fix-offset-table-range-check-do-not-rely-on-pointer-overflow.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 8de732bdcc2a4d0c09baf6b5e32be30e91a6d335 Mon Sep 17 00:00:00 2001 -From: Nikias Bassen -Date: Sat, 21 Nov 2020 04:09:58 +0100 -Subject: [PATCH] bplist: Fix offset table range check, don't rely on pointer - overflow - ---- - src/bplist.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/bplist.c b/src/bplist.c -index c3fc0717..12963c40 100644 ---- a/src/bplist.c -+++ b/src/bplist.c -@@ -837,7 +837,7 @@ PLIST_API void plist_from_bin(const char *plist_bin, uint32_t length, plist_t * - return; - } - -- if ((offset_table + offset_table_size < offset_table) || (offset_table + offset_table_size > end_data)) { -+ if (offset_table_size > (uint64_t)(end_data - offset_table)) { - PLIST_BIN_ERR("offset table points outside of valid range\n"); - return; - } diff --git a/0002-docs-Better-wording-for-plistutil-is-description-in-man-page.patch b/0002-docs-Better-wording-for-plistutil-is-description-in-man-page.patch deleted file mode 100644 index aff910c0f4781c8737da5f51d8f6689848285707..0000000000000000000000000000000000000000 --- a/0002-docs-Better-wording-for-plistutil-is-description-in-man-page.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 2899553df92cd4e10590da73ae7375e5b5517d45 Mon Sep 17 00:00:00 2001 -From: Nikias Bassen -Date: Sat, 21 Nov 2020 04:17:33 +0100 -Subject: [PATCH] docs: Better wording for plistutil's description in man page - ---- - docs/plistutil.1 | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/docs/plistutil.1 b/docs/plistutil.1 -index 042c94ee..e502bd7f 100644 ---- a/docs/plistutil.1 -+++ b/docs/plistutil.1 -@@ -7,7 +7,7 @@ plistutil \- Convert a plist FILE from binary to XML format or vice-versa - [-i FILE] - [-o FILE] - .SH DESCRIPTION --plistutil allows to convert a file in Property List format from binary to XML format or vice-versa. -+plistutil allows converting a file in Property List format from binary to XML format or vice-versa. - .SH OPTIONS - .TP - .B \-i, \-\-infile FILE diff --git a/0003-Improve-code-readability-by-not-using-else-after-return.patch b/0003-Improve-code-readability-by-not-using-else-after-return.patch deleted file mode 100644 index 1185a1df383c3026d0ce05cecdc23dd01a7b40c2..0000000000000000000000000000000000000000 --- a/0003-Improve-code-readability-by-not-using-else-after-return.patch +++ /dev/null @@ -1,307 +0,0 @@ -From 9f60cdd76b6044931cc2f2b6f2fbec3deb67a425 Mon Sep 17 00:00:00 2001 -From: Rosen Penev -Date: Sun, 7 Jun 2020 21:48:10 -0700 -Subject: [PATCH] Improve code readability by not using else after return - -[clang-tidy] Found with readability-else-after-return - -Signed-off-by: Rosen Penev ---- - src/plist.c | 78 ++++++++++++++++++++++++----------------------- - src/time64.c | 26 ++++++---------- - test/plist_cmp.c | 4 +-- - test/plist_test.c | 12 +++----- - 4 files changed, 55 insertions(+), 65 deletions(-) - -diff --git a/src/plist.c b/src/plist.c -index 57f0be47..4d327e06 100644 ---- a/src/plist.c -+++ b/src/plist.c -@@ -516,12 +516,11 @@ PLIST_API void plist_array_set_item(plist_t node, plist_t item, uint32_t n) - assert(idx >= 0); - if (idx < 0) { - return; -- } else { -- node_insert(node, idx, item); -- ptrarray_t* pa = ((plist_data_t)((node_t*)node)->data)->hashtable; -- if (pa) { -- ptr_array_set(pa, item, idx); -- } -+ } -+ node_insert(node, idx, item); -+ ptrarray_t* pa = ((plist_data_t)((node_t*)node)->data)->hashtable; -+ if (pa) { -+ ptr_array_set(pa, item, idx); - } - } - } -@@ -714,9 +713,8 @@ PLIST_API void plist_dict_set_item(plist_t node, const char* key, plist_t item) - assert(idx >= 0); - if (idx < 0) { - return; -- } else { -- node_insert(node, idx, item); - } -+ node_insert(node, idx, item); - key_node = node_prev_sibling(item); - } else { - key_node = plist_new_key(key); -@@ -1038,33 +1036,22 @@ int plist_data_compare(const void *a, const void *b) - case PLIST_UID: - if (val_a->length != val_b->length) - return FALSE; -- if (val_a->intval == val_b->intval) //it is an union so this is sufficient -- return TRUE; -- else -- return FALSE; -+ return val_a->intval == val_b->intval; //it is an union so this is sufficient - - case PLIST_KEY: - case PLIST_STRING: -- if (!strcmp(val_a->strval, val_b->strval)) -- return TRUE; -- else -- return FALSE; -+ return strcmp(val_a->strval, val_b->strval) == 0; - - case PLIST_DATA: - if (val_a->length != val_b->length) - return FALSE; -- if (!memcmp(val_a->buff, val_b->buff, val_a->length)) -- return TRUE; -- else -- return FALSE; -+ return memcmp(val_a->buff, val_b->buff, val_a->length) == 0; -+ - case PLIST_ARRAY: - case PLIST_DICT: - //compare pointer -- if (a == b) -- return TRUE; -- else -- return FALSE; -- break; -+ return a == b; -+ - default: - break; - } -@@ -1195,11 +1182,13 @@ PLIST_API int plist_uint_val_compare(plist_t uintnode, uint64_t cmpval) - plist_get_uint_val(uintnode, &uintval); - if (uintval == cmpval) { - return 0; -- } else if (uintval < cmpval) { -+ } -+ -+ if (uintval < cmpval) { - return -1; -- } else { -- return 1; - } -+ -+ return 1; - } - - PLIST_API int plist_uid_val_compare(plist_t uidnode, uint64_t cmpval) -@@ -1211,11 +1200,13 @@ PLIST_API int plist_uid_val_compare(plist_t uidnode, uint64_t cmpval) - plist_get_uid_val(uidnode, &uidval); - if (uidval == cmpval) { - return 0; -- } else if (uidval < cmpval) { -+ } -+ -+ if (uidval < cmpval) { - return -1; -- } else { -- return 1; - } -+ -+ return 1; - } - - PLIST_API int plist_real_val_compare(plist_t realnode, double cmpval) -@@ -1231,16 +1222,22 @@ PLIST_API int plist_real_val_compare(plist_t realnode, double cmpval) - double diff = fabs(a - b); - if (a == b) { - return 0; -- } else if (a == 0 || b == 0 || (abs_a + abs_b < DBL_MIN)) { -+ } -+ -+ if (a == 0 || b == 0 || (abs_a + abs_b < DBL_MIN)) { - if (diff < (DBL_EPSILON * DBL_MIN)) { - return 0; -- } else if (a < b) { -+ } -+ -+ if (a < b) { - return -1; - } - } else { - if ((diff / fmin(abs_a + abs_b, DBL_MAX)) < DBL_EPSILON) { - return 0; -- } else if (a < b) { -+ } -+ -+ if (a < b) { - return -1; - } - } -@@ -1259,11 +1256,13 @@ PLIST_API int plist_date_val_compare(plist_t datenode, int32_t cmpsec, int32_t c - uint64_t cmpval = ((int64_t)cmpsec << 32) | cmpusec; - if (dateval == cmpval) { - return 0; -- } else if (dateval < cmpval) { -+ } -+ -+ if (dateval < cmpval) { - return -1; -- } else { -- return 1; - } -+ -+ return 1; - } - - PLIST_API int plist_string_val_compare(plist_t strnode, const char* cmpval) -@@ -1328,9 +1327,12 @@ PLIST_API int plist_data_val_compare(plist_t datanode, const uint8_t* cmpval, si - plist_data_t data = plist_get_data(datanode); - if (data->length < n) { - return -1; -- } else if (data->length > n) { -+ } -+ -+ if (data->length > n) { - return 1; - } -+ - return memcmp(data->buff, cmpval, n); - } - -diff --git a/src/time64.c b/src/time64.c -index db571d88..364e159d 100644 ---- a/src/time64.c -+++ b/src/time64.c -@@ -176,34 +176,28 @@ static int is_exception_century(Year year) - static int cmp_date( const struct TM* left, const struct tm* right ) { - if( left->tm_year > right->tm_year ) - return 1; -- else if( left->tm_year < right->tm_year ) -+ if( left->tm_year < right->tm_year ) - return -1; -- - if( left->tm_mon > right->tm_mon ) - return 1; -- else if( left->tm_mon < right->tm_mon ) -+ if( left->tm_mon < right->tm_mon ) - return -1; -- - if( left->tm_mday > right->tm_mday ) - return 1; -- else if( left->tm_mday < right->tm_mday ) -+ if( left->tm_mday < right->tm_mday ) - return -1; -- - if( left->tm_hour > right->tm_hour ) - return 1; -- else if( left->tm_hour < right->tm_hour ) -+ if( left->tm_hour < right->tm_hour ) - return -1; -- - if( left->tm_min > right->tm_min ) - return 1; -- else if( left->tm_min < right->tm_min ) -+ if( left->tm_min < right->tm_min ) - return -1; -- - if( left->tm_sec > right->tm_sec ) - return 1; -- else if( left->tm_sec < right->tm_sec ) -+ if( left->tm_sec < right->tm_sec ) - return -1; -- - return 0; - } - -@@ -774,15 +768,15 @@ struct TM *localtime64_r (const Time64_T *timev, struct TM *local_tm) - static int valid_tm_wday( const struct TM* date ) { - if( 0 <= date->tm_wday && date->tm_wday <= 6 ) - return 1; -- else -- return 0; -+ -+ return 0; - } - - static int valid_tm_mon( const struct TM* date ) { - if( 0 <= date->tm_mon && date->tm_mon <= 11 ) - return 1; -- else -- return 0; -+ -+ return 0; - } - - -diff --git a/test/plist_cmp.c b/test/plist_cmp.c -index a07452b5..c8544463 100644 ---- a/test/plist_cmp.c -+++ b/test/plist_cmp.c -@@ -139,12 +139,10 @@ int main(int argc, char *argv[]) - printf("PList parsing failed\n"); - return 3; - } -- else -- printf("PList parsing succeeded\n"); - -+ printf("PList parsing succeeded\n"); - res = compare_plist(root_node1, root_node2); - -- - plist_free(root_node1); - plist_free(root_node2); - -diff --git a/test/plist_test.c b/test/plist_test.c -index b498e1da..6e3947ab 100644 ---- a/test/plist_test.c -+++ b/test/plist_test.c -@@ -77,36 +77,32 @@ int main(int argc, char *argv[]) - printf("PList XML parsing failed\n"); - return 3; - } -- else -- printf("PList XML parsing succeeded\n"); - -+ printf("PList XML parsing succeeded\n"); - plist_to_bin(root_node1, &plist_bin, &size_out); - if (!plist_bin) - { - printf("PList BIN writing failed\n"); - return 4; - } -- else -- printf("PList BIN writing succeeded\n"); - -+ printf("PList BIN writing succeeded\n"); - plist_from_bin(plist_bin, size_out, &root_node2); - if (!root_node2) - { - printf("PList BIN parsing failed\n"); - return 5; - } -- else -- printf("PList BIN parsing succeeded\n"); - -+ printf("PList BIN parsing succeeded\n"); - plist_to_xml(root_node2, &plist_xml2, &size_out2); - if (!plist_xml2) - { - printf("PList XML writing failed\n"); - return 8; - } -- else -- printf("PList XML writing succeeded\n"); - -+ printf("PList XML writing succeeded\n"); - if (plist_xml2) - { - FILE *oplist = NULL; diff --git a/libplist-2.2.0.tar.bz2 b/libplist-2.2.0.tar.bz2 deleted file mode 100644 index a70ff6830fb989f067bc6e9aa92fb1a0202f7aa0..0000000000000000000000000000000000000000 Binary files a/libplist-2.2.0.tar.bz2 and /dev/null differ diff --git a/libplist-2.3.0.tar.bz2 b/libplist-2.3.0.tar.bz2 new file mode 100644 index 0000000000000000000000000000000000000000..35eb431252a2eea20f12e2e51f6075a8eb1d10f6 Binary files /dev/null and b/libplist-2.3.0.tar.bz2 differ diff --git a/libplist-configure-c99.patch b/libplist-configure-c99.patch new file mode 100644 index 0000000000000000000000000000000000000000..4d65630e9367540878ec82de85e1cf391d01cd10 --- /dev/null +++ b/libplist-configure-c99.patch @@ -0,0 +1,21 @@ +configure: Use string for tm_zone assignment + +This matches what the actual sources do. Clang 16 and GCC 14 no longer +support converting ints to pointers implicitly, so the configure probe +always fails with these compilers. + +Submitted upstream: + +diff --git a/configure.ac b/configure.ac +index a9de50374c64849b..6ab01ae3a37312a9 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -120,7 +120,7 @@ AC_CACHE_CHECK(for tm_zone in struct tm, ac_cv_struct_tm_zone, + #include + ], [ + struct tm tm; +- tm.tm_zone = 1; ++ tm.tm_zone = (char*)"UTC"; + ])], + [ac_cv_struct_tm_zone=yes], + [ac_cv_struct_tm_zone=no] diff --git a/libplist.spec b/libplist.spec index 5360a770c44cce8e92f897796857ce7c562e0ada..78df991461a7bca6d5454b10df8ccf147d2695c7 100644 --- a/libplist.spec +++ b/libplist.spec @@ -1,14 +1,12 @@ Name: libplist -Version: 2.2.0 -Release: 4 +Version: 2.3.0 +Release: 1 Summary: A library to handle Apple Property List format in binary or XML License: LGPLv2+ URL: http://www.libimobiledevice.org/ Source0: https://github.com/libimobiledevice/libplist/releases/download/%{version}/%{name}-%{version}.tar.bz2 -Patch1: 0001-bplist-Fix-offset-table-range-check-do-not-rely-on-pointer-overflow.patch -Patch2: 0002-docs-Better-wording-for-plistutil-is-description-in-man-page.patch -Patch3: 0003-Improve-code-readability-by-not-using-else-after-return.patch +Patch0: libplist-configure-c99.patch BuildRequires: automake autoconf libtool chrpath gcc gcc-c++ python3-devel python3-Cython python3-setuptools @@ -61,8 +59,8 @@ make check %defattr(-,root,root) %doc AUTHORS README.md COPYING.LESSER %{_bindir}/plistutil -%{_libdir}/libplist*.so.3* -%{_libdir}/libplist++*.so.3* +%{_libdir}/libplist*.so.4* +%{_libdir}/libplist++*.so.4* %{_mandir}/man1/* %files devel @@ -77,6 +75,12 @@ make check %{_libdir}/python3*/site-packages/* %changelog +* Wed Jul 31 2024 dillon chen - 2.3.0-1 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC:Updated to 2.3.0 + * Wed Jul 24 2024 zhangxingrong - 2.2.0-4 - bplist: Fix offset table range check, don't rely on pointer overflow - docs: Better wording for plistutil's description in man page