61 Commits

Author SHA1 Message Date
Nikias Bassen 9dfcfe8dc2 Fix fread() unused return values by actually handling errors 2026-04-10 12:21:17 +02:00
Sami Kortelainen 6e03a1df6d xplist: Enforce single root value inside <plist>
Ensure that XML property lists contain exactly one root value inside the <plist> element and reject any additional value nodes before </plist>.

Add tests covering root value handling and nested CF$UID conversion behavior.

Co-authored-by: Sami Kortelainen <sami.kortelainen@piceasoft.com>
Co-authored-by: Nikias Bassen <nikias@gmx.li>
2026-02-25 02:27:00 +01:00
Nikias Bassen b7f09ccddd xplist: Improve robustness of XML text parsing and value conversion
This change adds stricter validation for numeric and date nodes,
including full-input consumption, overflow/range checks, and rejection
of invalid floating-point values. Whitespace handling is clarified by
explicitly trimming trailing XML whitespace for value nodes.
2026-01-29 17:45:01 +01:00
Nikias Bassen b32b370d8d test: Fix ostep-invalid-types test case 2025-12-05 21:33:24 +01:00
Ankur Tyagi 18e5b22a71 test: fix operator error
Otherwise test fail with error [: -neq: binary operator expected

Signed-off-by: Ankur Tyagi <ankur.tyagi85@gmail.com>
2025-11-20 16:01:58 +13:00
Sergei Trofimovich 2cd858c679 test: use unique output file names across tests
Without the change tests ran in parallel occasionally clobber outputs of
one another and fail as:

    $ make check -j16 VERBOSE=y
    ...
    FAIL: huge
    ==========
    Converting
    File ../test/data/5.plist is open
    PList XML parsing succeeded
    PList BIN writing succeeded
    PList BIN parsing succeeded
    PList XML writing succeeded
    Size of input and output is different
    Input size : 4292380
    Output size : 4305301
    Comparing
    PList parsing failed
    FAIL huge.test (exit status: 3)

Closes: https://github.com/libimobiledevice/libplist/issues/234#issuecomment-1743820556
2023-10-03 10:41:32 +01:00
Nikias Bassen bddb061bd6 test: Fix tests for distcheck 2023-04-21 16:04:40 +02:00
Nikias Bassen 6e65e1bfb4 Fix build 2023-04-21 12:51:28 +02:00
Sébastien Gonzalve 25ace1e8cb Add C++ interface test 2023-04-21 12:40:18 +02:00
Nikias Bassen ce9ce43efd Add plist_read_from_file() to interface, update plist_from_memory()
plist_read_from_file() is a convenience function that will open a
given file, checks its size, allocates a buffer large enough to
hold the full contents, and reads from file to fill the buffer.
Then, it calls plist_from_memory() to convert the data to plist
format.
A (breaking) change had to be made so that plist_from_memory() will
also return the parsed format in its 4th argument (if non-NULL).
2023-04-19 17:49:07 +02:00
Nikias Bassen d390800634 libcnary: Updated typedefs of node_t and node_list_t to contain pointer
This makes the code more readable. Obviously all the code that uses it
is also updated.
2023-02-06 18:28:28 +01:00
Nikias Bassen d886885b0e Rename PLIST_UINT to PLIST_INT and add plist_new_int() and plist_get_int_val()
This properly supports getting and setting signed or unsigned integer values.
Also, a new helper function plist_int_val_is_negative() was added to determine if
a given #PLIST_INT node has a negative value or not.

The old type PLIST_UINT is defined as a macro with the value of PLIST_INT for
backwards compatibility.

This commit also adds int vs. uint support to the C++ interface, and the python
bindings in a hopefully useful way.
2023-01-16 04:25:52 +01:00
Nikias Bassen 60d291941f Add support for OpenStep plist format 2023-01-08 05:29:22 +01:00
Nikias Bassen 366f30b71c test: Polish json3.test to not leave temp file after test 2022-02-07 10:01:08 +01:00
Nikias Bassen b8e9fedc5f test: Add int64 min/max testcase for JSON parser 2022-02-07 09:36:16 +01:00
Nikias Bassen e3ed270b6e test: Update JSON test case to have negative numbers 2022-01-31 03:31:57 +01:00
Nikias Bassen f3c65feb0e test: Rename json test files to .json 2022-01-25 03:54:10 +01:00
Nikias Bassen 17da5ba554 test: Add additional JSON test case 2022-01-25 01:47:59 +01:00
Nikias Bassen 914480a877 test: Work around JSON parser limitation expecting to have a 0-terminated string as input 2021-12-23 14:21:06 +01:00
Nikias Bassen 24dcee30c5 test: Update json test case to not rely on --enable-debug 2021-12-23 14:16:02 +01:00
Nikias Bassen 429cbc660a Add support for JSON format 2021-12-23 03:09:07 +01:00
Nikias Bassen 7000272144 test: Add PLIST_UID test case 2021-12-23 02:08:35 +01:00
Rosen Penev 9f60cdd76b Improve code readability by not using else after return
[clang-tidy] Found with readability-else-after-return

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-11-24 01:06:31 +01:00
Nikias Bassen eff97404bd Add API version to library and pkgconfig file for proper linking 2020-06-14 23:18:39 +02:00
Martin Szulecki c14849987d Unfold automake variables into multiple lines for maintainability 2020-06-09 18:19:07 +02:00
Nikias Bassen 25ab3ae7a4 test: Use diff --strip-trailing-cr to fix tests on windows 2019-12-18 03:53:18 +01:00
Nikias Bassen 8b5662a436 test: Write outputfile to test log for signedunsigned2 test 2019-12-18 02:08:36 +01:00
Nikias Bassen 8e5b802cb9 test: Merge *cmp.test into *.test to allow parallel testing 2019-05-16 03:57:47 +02:00
Christophe Fergeau d0193690c8 test: Rename dates.test output files so the get removed upon 'make distclean' 2017-04-20 12:30:50 +02:00
Christophe Fergeau 1a046c184a test: Add missing test files to Makefile.am/EXTRA_DIST 2017-04-20 12:21:27 +02:00
Nikias Bassen 9d2331d020 test: Fix wrong filename in EXTRA_DIST entry of Makefile.am 2017-04-20 11:15:23 +02:00
Nikias Bassen 5791fb908a test: Add test cases for different bplist offset and reference sizes 2017-02-01 19:07:02 +01:00
Nikias Bassen 9950acbecd test: Add some more test cases for various valid and invalid content 2017-01-02 02:29:35 +01:00
Nikias Bassen 9f03f8aabc test: Add new test case for dictionaries with empty keys 2017-01-02 02:08:02 +01:00
Nikias Bassen 552801556f test: Add new test case for entities 2017-01-02 02:06:39 +01:00
Nikias Bassen 3e2d8706bf test: Fix test plist having duplicate keys in dictionary 2016-11-18 03:39:23 +01:00
Nikias Bassen a3263ad344 test: Add additional test case to check extended date range 2016-09-19 03:19:45 +02:00
Nikias Bassen 02bd8acd41 test: Add another test case for signed/unsigned (multiple) integers
Apart from testing the actual integer signed vs. unsigned value storage
and conversion, this test will check that the binary plist optimization
is not re-using existing values. Basically it will test the fix that
was introduced with commit acd226d1f7.
2016-06-29 05:49:53 +02:00
Nikias Bassen 9ca25d293f test: Add missing .test files 2015-02-05 22:25:09 +01:00
Nikias Bassen 43ae9d35ba test: Add more test cases covering binary plist issues 2015-02-05 14:50:50 +01:00
Nikias Bassen 62813daf2c Avoid exporting non-public symbols 2014-10-03 15:39:47 +02:00
Martin Szulecki cf739732cf test: Fix make clean in relation with out-of-tree build directory 2014-06-13 19:30:09 +02:00
Martin Szulecki 06e7233b6b test: Add keys with XML entities to data plist files 2014-05-27 10:41:59 +02:00
Martin Szulecki cc3efde36a test: Fix clean target to remove all generated files 2014-05-27 10:39:42 +02:00
Nikias Bassen f7c829297a test: Add test cases for integer nodes 2014-05-23 11:24:08 +02:00
Nikias Bassen 769ee9ecda test: Add data/7.plist to extra_dist target 2014-05-23 11:13:52 +02:00
Nikias Bassen 8ac53f53b6 test: Use better test data for timezone tests 2014-05-22 20:26:26 +02:00
Nikias Bassen df053ccdbb test: Fix timezone test cases with set -e 2014-04-02 15:46:52 +02:00
Nikias Bassen e1a4bd03ec test: Add new timezone tests 2014-04-01 17:37:38 +02:00
Martin Szulecki 6dcc8c48bb Replace some LDADD references to use $(top_builddir) for distcheck 2014-02-13 18:56:35 +01:00