├── .gitattributes ├── .github └── workflows │ ├── build.yml │ ├── cifuzz.yml │ └── codeql-analysis.yml ├── .gitignore ├── AUTHORS ├── COPYING ├── COPYING.LESSER ├── Makefile.am ├── NEWS ├── README.md ├── autogen.sh ├── configure.ac ├── cython ├── Makefile.am ├── plist.pxd ├── plist.pyx ├── plist_util.c └── plist_util.h ├── docs ├── Makefile.am └── plistutil.1 ├── doxygen.cfg.in ├── fuzz ├── Makefile.am ├── bplist-crashes │ ├── clusterfuzz-testcase-4766291097288704 │ ├── clusterfuzz-testcase-4930725262393344 │ ├── clusterfuzz-testcase-5421965105954816 │ ├── clusterfuzz-testcase-5556177727389696 │ ├── clusterfuzz-testcase-6557963011489792 │ ├── clusterfuzz-testcase-6605859144597504 │ ├── crash-0ce4dd483b645bc05ec45a97d285dcf1933ee840 │ ├── crash-0d59cdcb5c3416c2790612b78a631ce9f5622800 │ ├── crash-17d635ab460fef74df1ac7561f1253533a6359c5 │ ├── crash-33a67313fa7864cd627ef92d12017a127d342f28 │ ├── crash-39f1347115f8fe9ac25cdc9332e3fc5cd32c7f7b │ ├── crash-4bd78175fe01d07c5ee90104fbc68d95dd092210 │ ├── crash-4c5404453bb7425aef9b953a5f6f3f0afcc48392 │ ├── crash-52775e25f6af20af351cd616834e602fc988a032 │ ├── crash-6d1399685b745d3d49fadc91072fabcdde8d16fa │ ├── crash-94b3725900d63c6258448fd757559c81002de9c9 │ ├── crash-a47195acbabc3f5b2cda9c6ebda42f2afc1cc5af │ ├── crash-ce852bae6aeeffc4698a93660236f1b995ce966e │ ├── crash-daddb6e82e3d1ed76e20e4131462f5247a6fb131 │ ├── crash-f21be4ebce7f9c337bf96b93cec7e252f5c75a21 │ └── crash-f779dafccc0164684d1a264976e56037188b40e2 ├── bplist-leaks │ ├── leak-96fb453b3ba18d31e164831795a708183b5a0dac │ ├── leak-acb3c00a83d7635638a476a4e70fc1f1caa1a5b1 │ └── leak-fe2cd4b1f67e0c9b21e6225a4fb4ca19eab80074 ├── bplist.dict ├── bplist_fuzzer.cc ├── bplist_fuzzer.options ├── fuzzers.test ├── init-fuzzers.sh ├── jplist-crashes │ ├── clusterfuzz-testcase-minimized-jplist_fuzzer-4997614678966272 │ ├── clusterfuzz-testcase-minimized-jplist_fuzzer-5149455463088128 │ ├── clusterfuzz-testcase-minimized-jplist_fuzzer-5161359598288896 │ ├── clusterfuzz-testcase-minimized-jplist_fuzzer-5486807695884288 │ ├── clusterfuzz-testcase-minimized-jplist_fuzzer-5576833398079488 │ ├── clusterfuzz-testcase-minimized-jplist_fuzzer-5704016686874624 │ └── clusterfuzz-testcase-minimized-jplist_fuzzer-6639076466360320 ├── jplist-leaks │ ├── clusterfuzz-testcase-minimized-jplist_fuzzer-4881933237092352 │ ├── clusterfuzz-testcase-minimized-jplist_fuzzer-5069883912617984 │ └── clusterfuzz-testcase-minimized-jplist_fuzzer-5816111696838656 ├── jplist.dict ├── jplist_fuzzer.cc ├── jplist_fuzzer.options ├── oplist-crashes │ ├── clusterfuzz-testcase-minimized-oplist_fuzzer-4503815405830144 │ ├── clusterfuzz-testcase-minimized-oplist_fuzzer-4683683569467392 │ ├── clusterfuzz-testcase-minimized-oplist_fuzzer-4716194114699264 │ └── clusterfuzz-testcase-minimized-oplist_fuzzer-4789915626110976 ├── oplist-leaks │ ├── clusterfuzz-testcase-minimized-oplist_fuzzer-6043548602728448 │ └── clusterfuzz-testcase-minimized-oplist_fuzzer-6497436988473344 ├── oplist.dict ├── oplist_fuzzer.cc ├── oplist_fuzzer.options ├── test-fuzzers.sh ├── xplist-crashes │ ├── clusterfuzz-testcase-4516959125241856 │ ├── clusterfuzz-testcase-4663876528373760 │ ├── clusterfuzz-testcase-5799076113154048 │ ├── clusterfuzz-testcase-5922404220010496 │ ├── clusterfuzz-testcase-6015098361479168 │ ├── clusterfuzz-testcase-6043836860071936 │ ├── clusterfuzz-testcase-6047509906456576 │ ├── clusterfuzz-testcase-6482601374121984 │ ├── crash-09788d7acb46b4b177422f9c4ee54556a3ad1f17 │ ├── crash-155c60d5c4b2778110fb4a633caa7d64eb9b99c1 │ ├── crash-348c909a0b3532977185f551eb5d2ed04e694883 │ ├── crash-7bc172e27a2b1d4fcaf031f59d1f08fb83081e4a │ ├── crash-80c28b0e2a446665e68927dd4441c10c9a68e64e │ ├── crash-8acf177da60ecf13c36d0da1b8e25de891980ea6 │ ├── crash-94276cf69a50e78dd6cdf079c208cb80f357cd33 │ ├── crash-9ddb891a0ec42401eb4629e6b99e01aef7909eb9 │ ├── crash-a8b44e1f5be4f75f00a937016ec5405bce77a0f9 │ ├── crash-da39a3ee5e6b4b0d3255bfef95601890afd80709 │ └── crash-f03c680ee1c4d84c28e731752df77a61e213a24d ├── xplist-leaks │ ├── clusterfuzz-testcase-4634751103139840 │ ├── clusterfuzz-testcase-6056412121661440 │ ├── leak-47b0a9f21d3affab6cfc898e5140bb53265ada07 │ ├── leak-4c81aae70b20d9b9408b78d40999a54205bdcfb7 │ └── leak-53bc466851eda790bd891733da5db0a7482886bf ├── xplist.dict ├── xplist_fuzzer.cc └── xplist_fuzzer.options ├── git-version-gen ├── include ├── Makefile.am └── plist │ ├── Array.h │ ├── Boolean.h │ ├── Data.h │ ├── Date.h │ ├── Dictionary.h │ ├── Integer.h │ ├── Key.h │ ├── Node.h │ ├── Real.h │ ├── String.h │ ├── Structure.h │ ├── Uid.h │ ├── plist++.h │ └── plist.h ├── libcnary ├── COPYING ├── Makefile.am ├── README ├── cnary.c ├── include │ ├── node.h │ ├── node_list.h │ └── object.h ├── node.c └── node_list.c ├── m4 ├── ac_pkg_cython.m4 ├── as-compiler-flag.m4 ├── ax_pthread.m4 ├── ax_python_devel.m4 └── cython_python.m4 ├── src ├── Array.cpp ├── Boolean.cpp ├── Data.cpp ├── Date.cpp ├── Dictionary.cpp ├── Integer.cpp ├── Key.cpp ├── Makefile.am ├── Node.cpp ├── Real.cpp ├── String.cpp ├── Structure.cpp ├── Uid.cpp ├── base64.c ├── base64.h ├── bplist.c ├── bytearray.c ├── bytearray.h ├── hashtable.c ├── hashtable.h ├── jplist.c ├── jsmn.c ├── jsmn.h ├── libplist++-2.0.pc.in ├── libplist-2.0.pc.in ├── oplist.c ├── out-default.c ├── out-limd.c ├── out-plutil.c ├── plist.c ├── plist.h ├── ptrarray.c ├── ptrarray.h ├── strbuf.h ├── time64.c ├── time64.h ├── time64_limits.h └── xplist.c ├── test ├── Makefile.am ├── amp.test ├── bigarray++.test ├── bigarray.test ├── cdata.test ├── data │ ├── 1.plist │ ├── 2.plist │ ├── 3.plist │ ├── 4.plist │ ├── 5.plist │ ├── 6.plist │ ├── 7.plist │ ├── amp.plist │ ├── cdata.plist │ ├── data.bplist │ ├── dictref1byte.bplist │ ├── dictref2bytes.bplist │ ├── dictref3bytes.bplist │ ├── dictref4bytes.bplist │ ├── dictref5bytes.bplist │ ├── dictref6bytes.bplist │ ├── dictref7bytes.bplist │ ├── dictref8bytes.bplist │ ├── empty_keys.plist │ ├── entities.plist │ ├── hex.plist │ ├── int64_min_max.json │ ├── invalid_tag.plist │ ├── j1.json │ ├── j2.json │ ├── malformed_dict.bplist │ ├── o1.ostep │ ├── o2.ostep │ ├── o3.ostep │ ├── off1byte.bplist │ ├── off2bytes.bplist │ ├── off3bytes.bplist │ ├── off4bytes.bplist │ ├── off5bytes.bplist │ ├── off6bytes.bplist │ ├── off7bytes.bplist │ ├── off8bytes.bplist │ ├── offxml.plist │ ├── order.bplist │ ├── order.plist │ ├── recursion.bplist │ ├── signed.bplist │ ├── signed.plist │ ├── signedunsigned.bplist │ ├── signedunsigned.plist │ ├── test.strings │ ├── uid.bplist │ ├── unsigned.bplist │ └── unsigned.plist ├── dates.test ├── empty++.test ├── empty.test ├── empty_keys.test ├── entities.test ├── hex.test ├── huge++.test ├── huge.test ├── integer_set.c ├── integer_set.test ├── invalid_tag.test ├── json-int64-min-max.test ├── json-invalid-types.test ├── json1.test ├── json2.test ├── json3.test ├── large++.test ├── large.test ├── malformed_dict.test ├── medium++.test ├── medium.test ├── offsetsize.test ├── order.test ├── ostep-comments.test ├── ostep-invalid-types.test ├── ostep-strings.test ├── ostep1.test ├── ostep2.test ├── plist_btest.c ├── plist_cmp.c ├── plist_jtest.c ├── plist_otest.c ├── plist_test++.cpp ├── plist_test.c ├── recursion.test ├── refsize.test ├── signedunsigned1.test ├── signedunsigned2.test ├── signedunsigned3.test ├── small++.test ├── small.test ├── timezone1.test ├── timezone2.test └── uid.test └── tools ├── Makefile.am └── plistutil.c /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | -------------------------------------------------------------------------------- /.github/workflows/cifuzz.yml: -------------------------------------------------------------------------------- 1 | name: CIFuzz 2 | on: [pull_request] 3 | jobs: 4 | Fuzzing: 5 | runs-on: ubuntu-latest 6 | steps: 7 | - name: Build Fuzzers 8 | id: build 9 | uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master 10 | with: 11 | oss-fuzz-project-name: 'libplist' 12 | dry-run: false 13 | language: c++ 14 | - name: Run Fuzzers 15 | uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master 16 | with: 17 | oss-fuzz-project-name: 'libplist' 18 | fuzz-seconds: 300 19 | dry-run: false 20 | language: c++ 21 | - name: Upload Crash 22 | uses: actions/upload-artifact@v4 23 | if: failure() && steps.build.outcome == 'success' 24 | with: 25 | name: artifacts 26 | path: ./out/artifacts 27 | -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | # For most projects, this workflow file will not need changing; you simply need 2 | # to commit it to your repository. 3 | # 4 | # You may wish to alter this file to override the set of languages analyzed, 5 | # or to provide custom queries or build logic. 6 | name: "CodeQL" 7 | 8 | on: 9 | push: 10 | branches: [master] 11 | pull_request: 12 | # The branches below must be a subset of the branches above 13 | branches: [master] 14 | 15 | jobs: 16 | analyze: 17 | name: Analyze 18 | runs-on: ubuntu-latest 19 | 20 | strategy: 21 | fail-fast: false 22 | matrix: 23 | # Override automatic language detection by changing the below list 24 | # Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python'] 25 | language: ['cpp'] 26 | # Learn more... 27 | # https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection 28 | 29 | steps: 30 | - name: Checkout repository 31 | uses: actions/checkout@v4 32 | with: 33 | # We must fetch at least the immediate parents so that if this is 34 | # a pull request then we can checkout the head. 35 | fetch-depth: 0 36 | 37 | # Initializes the CodeQL tools for scanning. 38 | - name: Initialize CodeQL 39 | uses: github/codeql-action/init@v3 40 | with: 41 | languages: ${{ matrix.language }} 42 | # If you wish to specify custom queries, you can do so here or in a config file. 43 | # By default, queries listed here will override any specified in a config file. 44 | # Prefix the list here with "+" to use these queries and those in the config file. 45 | # queries: ./path/to/local/query, your-org/your-repo/queries@main 46 | 47 | - name: Build 48 | run: | 49 | ./autogen.sh --enable-debug --without-cython 50 | make 51 | 52 | - name: Perform CodeQL Analysis 53 | uses: github/codeql-action/analyze@v3 54 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | *.o 3 | *.lo 4 | *.la 5 | *.pc 6 | *.log 7 | *.exe 8 | *~ 9 | .kateconfig 10 | configure 11 | Makefile 12 | Makefile.in 13 | aclocal.m4 14 | autom4te.cache 15 | compile 16 | config.* 17 | depcomp 18 | doxygen.cfg 19 | install-sh 20 | libtool 21 | ltmain.sh 22 | missing 23 | stamp-h1 24 | m4/libtool.m4 25 | m4/ltoptions.m4 26 | m4/ltsugar.m4 27 | m4/ltversion.m4 28 | m4/lt~obsolete.m4 29 | src/Makefile 30 | src/Makefile.in 31 | src/.libs 32 | src/.deps 33 | fuzz/.deps 34 | fuzz/.libs 35 | include/Makefile 36 | include/Makefile.in 37 | libcnary/Makefile 38 | libcnary/Makefile.in 39 | libcnary/.libs 40 | libcnary/.deps 41 | tools/Makefile 42 | tools/Makefile.in 43 | tools/.libs 44 | tools/.deps 45 | tools/plistutil 46 | test/Makefile 47 | test/Makefile.in 48 | test/.libs 49 | test/.deps 50 | test/plist_cmp 51 | test/plist_test 52 | test/plist_test++ 53 | test/plist_btest 54 | test/plist_jtest 55 | test/plist_otest 56 | test/integer_set_test 57 | test/data/*.out 58 | test/*.trs 59 | cython/Makefile 60 | cython/Makefile.in 61 | cython/.deps 62 | cython/.libs 63 | cython/plist.c 64 | test-driver 65 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Aaron Burghardt 2 | Alexander Sack 3 | Andrew Udvare 4 | Bryan Forbes 5 | Chow Loong Jin 6 | Christophe Fergeau 7 | Dogbert 8 | Elan Ruusamäe 9 | Filippo Bigarella 10 | Frederik Carlier 11 | Glenn Washburn 12 | Greg Dennis 13 | Ingmar Vanhassel 14 | Jim Koning 15 | Jonathan Beck 16 | Julien Blache 17 | Martin Aumueller 18 | Martin Szulecki 19 | Matt Colyer 20 | Matthias Klose 21 | Nicolás Alvarez 22 | Nikias Bassen 23 | Patrick von Reth 24 | Patrick Walton 25 | Paul Sladen 26 | Shane G 27 | Wang Junjie 28 | Zach C 29 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS = foreign 2 | ACLOCAL_AMFLAGS = -I m4 3 | SUBDIRS = libcnary src include tools docs 4 | 5 | if HAVE_CYTHON 6 | SUBDIRS += cython 7 | endif 8 | 9 | if BUILD_TESTS 10 | SUBDIRS += test 11 | endif 12 | 13 | if BUILD_FUZZERS 14 | SUBDIRS += fuzz 15 | endif 16 | 17 | EXTRA_DIST = \ 18 | README.md \ 19 | git-version-gen 20 | 21 | dist-hook: 22 | @if ! git diff --quiet; then echo "Uncommitted changes present; not releasing"; exit 1; fi 23 | echo $(VERSION) > $(distdir)/.tarball-version 24 | 25 | docs/html: $(top_builddir)/doxygen.cfg $(top_srcdir)/include/plist/*.h 26 | rm -rf docs/html 27 | doxygen doxygen.cfg 28 | 29 | docs/README.doxygen.md: README.md 30 | awk '/\#\# Table of Contents/{while(getline && $$0 != ""){}{print "[TOC]"}}1' README.md > $@ 31 | 32 | docs: doxygen.cfg docs/README.doxygen.md docs/html 33 | -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | olddir=`pwd` 4 | srcdir=`dirname $0` 5 | test -z "$srcdir" && srcdir=. 6 | 7 | ( 8 | cd "$srcdir" 9 | 10 | gprefix=`which glibtoolize 2>&1 >/dev/null` 11 | if [ $? -eq 0 ]; then 12 | glibtoolize --force 13 | else 14 | libtoolize --force 15 | fi 16 | aclocal -I m4 17 | autoheader 18 | automake --add-missing 19 | autoconf 20 | 21 | cd "$olddir" 22 | ) 23 | 24 | if [ -z "$NOCONFIGURE" ]; then 25 | $srcdir/configure "$@" 26 | fi 27 | -------------------------------------------------------------------------------- /cython/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = -I$(top_srcdir)/include 2 | 3 | AM_CFLAGS = $(GLOBAL_CFLAGS) 4 | AM_LDFLAGS = $(GLOBAL_LDFLAGS) 5 | 6 | EXTRA_DIST = \ 7 | plist.pyx \ 8 | plist.pxd 9 | 10 | if HAVE_CYTHON 11 | 12 | BUILT_SOURCES = plist.c 13 | 14 | PXDINCLUDES = \ 15 | plist.pxd \ 16 | $(CYTHON_PLIST_INCLUDE_DIR)/plist.pxd 17 | 18 | CLEANFILES = \ 19 | *.pyc \ 20 | *.pyo \ 21 | plist.c 22 | 23 | plistdir = $(pyexecdir) 24 | plist_LTLIBRARIES = plist.la 25 | plist_la_SOURCES = \ 26 | plist_util.c \ 27 | plist_util.h \ 28 | plist.pyx 29 | 30 | plist_la_CFLAGS = \ 31 | -I$(top_srcdir)/include \ 32 | -I$(top_srcdir)/src \ 33 | $(PYTHON_CPPFLAGS) \ 34 | $(AM_CFLAGS) \ 35 | -Wno-shadow \ 36 | -Wno-redundant-decls \ 37 | -Wno-switch-default \ 38 | -Wno-strict-aliasing \ 39 | -Wno-implicit-function-declaration \ 40 | -fvisibility=default 41 | 42 | plist_la_LDFLAGS = -module -avoid-version $(PYTHON_LIBS) $(AM_LDFLAGS) -shared -export-dynamic 43 | plist_la_LIBADD = $(top_builddir)/src/libplist-2.0.la 44 | 45 | if WIN32 46 | plist_la_LDFLAGS += -no-undefined 47 | endif 48 | 49 | plist.c: plist.pyx $(PXDINCLUDES) $(PXIINCLUDES) 50 | 51 | .pyx.c: 52 | $(CYTHON) -I$(CYTHON_PLIST_INCLUDE_DIR) -I$(top_srcdir)/src -o $@ $< 53 | 54 | pxddir = $(includedir)/plist/cython 55 | pxd_DATA = plist.pxd 56 | 57 | endif 58 | -------------------------------------------------------------------------------- /cython/plist.pxd: -------------------------------------------------------------------------------- 1 | from libc.stdint cimport * 2 | 3 | cdef extern from "plist/plist.h": 4 | ctypedef void *plist_t 5 | ctypedef void *plist_dict_iter 6 | void plist_free(plist_t node) 7 | 8 | cdef class Node: 9 | cdef plist_t _c_node 10 | cdef bint _c_managed 11 | cpdef object __deepcopy__(self, memo=*) 12 | cpdef unicode to_xml(self) 13 | cpdef bytes to_bin(self) 14 | cpdef object copy(self) 15 | 16 | cdef class Bool(Node): 17 | cpdef set_value(self, object value) 18 | cpdef bint get_value(self) 19 | 20 | cdef class Integer(Node): 21 | cpdef set_value(self, object value) 22 | cpdef get_value(self) 23 | cpdef bint is_negative(self) 24 | 25 | cdef class Uid(Node): 26 | cpdef set_value(self, object value) 27 | cpdef uint64_t get_value(self) 28 | 29 | cdef class Key(Node): 30 | cpdef set_value(self, object value) 31 | cpdef unicode get_value(self) 32 | 33 | cdef class Real(Node): 34 | cpdef set_value(self, object value) 35 | cpdef float get_value(self) 36 | 37 | cdef class String(Node): 38 | cpdef set_value(self, object value) 39 | cpdef unicode get_value(self) 40 | 41 | cdef class Date(Node): 42 | cpdef set_value(self, object value) 43 | cpdef object get_value(self) 44 | 45 | cdef class Data(Node): 46 | cpdef set_value(self, object value) 47 | cpdef bytes get_value(self) 48 | 49 | cdef class Dict(Node): 50 | cdef dict _map 51 | cdef void _init(self) 52 | cpdef set_value(self, dict value) 53 | cpdef dict get_value(self) 54 | cpdef bint has_key(self, key) 55 | cpdef object get(self, key, default=*) 56 | cpdef list keys(self) 57 | cpdef list items(self) 58 | cpdef list values(self) 59 | cpdef object iterkeys(self) 60 | cpdef object iteritems(self) 61 | cpdef object itervalues(self) 62 | 63 | cdef class Array(Node): 64 | cdef list _array 65 | cdef void _init(self) 66 | cpdef set_value(self, value) 67 | cpdef list get_value(self) 68 | cpdef append(self, object item) 69 | 70 | cpdef object from_xml(xml) 71 | cpdef object from_bin(bytes bin) 72 | 73 | cpdef object load(fp, fmt=*, use_builtin_types=*, dict_type=*) 74 | cpdef object loads(data, fmt=*, use_builtin_types=*, dict_type=*) 75 | cpdef object dump(value, fp, fmt=*, sort_keys=*, skipkeys=*) 76 | cpdef object dumps(value, fmt=*, sort_keys=*, skipkeys=*) 77 | 78 | cdef object plist_t_to_node(plist_t c_plist, bint managed=*) 79 | cdef plist_t native_to_plist_t(object native) 80 | -------------------------------------------------------------------------------- /cython/plist_util.c: -------------------------------------------------------------------------------- 1 | #include "plist_util.h" 2 | 3 | #include 4 | #include 5 | 6 | int64_t datetime_to_timestamp(PyObject* obj) { 7 | PyDateTime_IMPORT; 8 | if (!PyDateTime_Check(obj)) { 9 | PyErr_SetString(PyExc_ValueError,"Expected a datetime"); 10 | return 0; 11 | } 12 | struct tm t; 13 | memset(&t, 0, sizeof(t)); 14 | t.tm_sec = PyDateTime_DATE_GET_SECOND(obj); 15 | t.tm_min = PyDateTime_DATE_GET_MINUTE(obj); 16 | t.tm_hour = PyDateTime_DATE_GET_HOUR(obj); 17 | t.tm_mday = PyDateTime_GET_DAY(obj); 18 | t.tm_mon = PyDateTime_GET_MONTH(obj)-1; 19 | t.tm_year = PyDateTime_GET_YEAR(obj)-1900; 20 | return mktime(&t); 21 | } 22 | PyObject* timestamp_to_datetime(int64_t sec) { 23 | time_t sec_tt = sec; 24 | struct tm* t = gmtime(&sec_tt); 25 | if(t){ 26 | PyDateTime_IMPORT; 27 | return PyDateTime_FromDateAndTime(t->tm_year+1900, t->tm_mon+1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec, 0); 28 | } 29 | return NULL; 30 | } 31 | int check_datetime(PyObject* ob) { 32 | if(ob){ 33 | PyDateTime_IMPORT; 34 | return PyDateTime_Check(ob); 35 | } 36 | return 0; 37 | } 38 | -------------------------------------------------------------------------------- /cython/plist_util.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int64_t datetime_to_timestamp(PyObject* obj); 4 | PyObject* timestamp_to_datetime(int64_t sec); 5 | int check_datetime(PyObject* obj); 6 | -------------------------------------------------------------------------------- /docs/Makefile.am: -------------------------------------------------------------------------------- 1 | man_MANS = plistutil.1 2 | 3 | EXTRA_DIST = $(man_MANS) 4 | -------------------------------------------------------------------------------- /docs/plistutil.1: -------------------------------------------------------------------------------- 1 | .TH "plistutil" 1 2 | .SH NAME 3 | plistutil \- Convert a plist FILE between binary, XML, and JSON format 4 | .SH SYNOPSIS 5 | .B plistutil 6 | [OPTIONS] 7 | [-i FILE] 8 | [-o FILE] 9 | .SH DESCRIPTION 10 | plistutil allows converting a Property List file between binary, XML, and JSON format. 11 | .SH OPTIONS 12 | .TP 13 | .B \-i, \-\-infile FILE 14 | Input FILE to convert from. If this argument is omitted or - is passed as 15 | filename, plistutil will read from stdin. 16 | .TP 17 | .B \-o, \-\-outfile FILE 18 | Output FILE to convert to. If this argument is omitted or - is passed as 19 | filename, plistutil will write to stdout. 20 | .TP 21 | .B \-f, \-\-format [bin|xml|json|openstep] 22 | Force output format, regardless of input type. This is useful if the input 23 | format is not known, but the output format should always be in a specific 24 | format (like xml or json). 25 | 26 | If omitted, XML plist data will be converted to binary and vice-versa. To 27 | convert to/from JSON or OpenStep the output format needs to specified. 28 | .TP 29 | .B \-p, \-\-print FILE 30 | Print PList in human-readable format. 31 | .TP 32 | .B \-c, \-\-compact 33 | JSON and OpenStep only: Print output in compact form. By default, the output 34 | will be pretty-printed. 35 | .TP 36 | .B \-s, \-\-sort 37 | Sort all dictionary nodes lexicographically by key before converting to the output format. 38 | .TP 39 | .B \-h, \-\-help 40 | Prints usage information. 41 | .TP 42 | .B \-d, \-\-debug 43 | Enabled extended debug output. 44 | .TP 45 | .B \-v, \-\-version 46 | Print version information 47 | .SH EXAMPLES 48 | .TP 49 | .B plistutil -i test.plist -o out.plist 50 | Convert test.plist and write to out.plist. If test.plist is in XML format, 51 | out.plist will be in binary format. If test.plist is in binary format, 52 | out.plist will be in XML format. 53 | .TP 54 | .B plistutil -i test.plist -o out.plist -f bin 55 | Same as before, but the output will always be in binary format. 56 | .TP 57 | .B plistutil -i test.plist -f xml 58 | Print test.plist as XML plist, regardless of the input format. 59 | .TP 60 | .B plistutil -i test.plist -f xml -o - 61 | Same as before. 62 | .TP 63 | .B plistutil -i test.plist -f json 64 | Print test.plist as JSON plist, regardless of the input format. 65 | .TP 66 | .B cat test.plist |plistutil -f xml 67 | Take plist data from stdin - piped via cat - and write the output as XML 68 | to stdout. 69 | .SH AUTHORS 70 | Zach C. 71 | 72 | Martin Szulecki 73 | 74 | Nikias Bassen 75 | .SH ON THE WEB 76 | https://libimobiledevice.org 77 | 78 | https://github.com/libimobiledevice/libplist 79 | -------------------------------------------------------------------------------- /fuzz/Makefile.am: -------------------------------------------------------------------------------- 1 | if BUILD_FUZZERS 2 | 3 | libFuzzer.a: Fuzzer/build.sh 4 | @echo "Building $@" 5 | @./Fuzzer/build.sh 6 | 7 | Fuzzer/build.sh: LIBFUZZER_SRC 8 | 9 | LIBFUZZER_SRC: 10 | @if test -d Fuzzer ; then \ 11 | if test -d Fuzzer/.git ; then \ 12 | echo Making sure libFuzzer source tree is up-to-date... ; \ 13 | cd Fuzzer && git checkout . && git pull && cd .. ; \ 14 | fi \ 15 | else \ 16 | echo Checking out libFuzzer source code... ; \ 17 | git clone https://chromium.googlesource.com/chromium/llvm-project/llvm/lib/Fuzzer ; \ 18 | fi 19 | 20 | CLEANFILES = libFuzzer.a 21 | 22 | noinst_PROGRAMS = \ 23 | xplist_fuzzer \ 24 | bplist_fuzzer \ 25 | jplist_fuzzer \ 26 | oplist_fuzzer 27 | 28 | xplist_fuzzer_SOURCES = xplist_fuzzer.cc 29 | xplist_fuzzer_LDFLAGS = -static 30 | xplist_fuzzer_LDADD = $(top_builddir)/src/libplist-2.0.la libFuzzer.a 31 | 32 | bplist_fuzzer_SOURCES = bplist_fuzzer.cc 33 | bplist_fuzzer_LDFLAGS = -static 34 | bplist_fuzzer_LDADD = $(top_builddir)/src/libplist-2.0.la libFuzzer.a 35 | 36 | jplist_fuzzer_SOURCES = jplist_fuzzer.cc 37 | jplist_fuzzer_LDFLAGS = -static 38 | jplist_fuzzer_LDADD = $(top_builddir)/src/libplist-2.0.la libFuzzer.a 39 | 40 | oplist_fuzzer_SOURCES = oplist_fuzzer.cc 41 | oplist_fuzzer_LDFLAGS = -static 42 | oplist_fuzzer_LDADD = $(top_builddir)/src/libplist-2.0.la libFuzzer.a 43 | 44 | TESTS = fuzzers.test 45 | 46 | EXTRA_DIST = \ 47 | bplist.dict \ 48 | xplist.dict \ 49 | jplist.dict \ 50 | oplist.dict \ 51 | init-fuzzers.sh \ 52 | test-fuzzers.sh \ 53 | fuzzers.test 54 | 55 | endif 56 | -------------------------------------------------------------------------------- /fuzz/bplist-crashes/clusterfuzz-testcase-4766291097288704: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/fuzz/bplist-crashes/clusterfuzz-testcase-4766291097288704 -------------------------------------------------------------------------------- /fuzz/bplist-crashes/clusterfuzz-testcase-4930725262393344: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/fuzz/bplist-crashes/clusterfuzz-testcase-4930725262393344 -------------------------------------------------------------------------------- /fuzz/bplist-crashes/clusterfuzz-testcase-5421965105954816: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/fuzz/bplist-crashes/clusterfuzz-testcase-5421965105954816 -------------------------------------------------------------------------------- /fuzz/bplist-crashes/clusterfuzz-testcase-5556177727389696: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/fuzz/bplist-crashes/clusterfuzz-testcase-5556177727389696 -------------------------------------------------------------------------------- /fuzz/bplist-crashes/clusterfuzz-testcase-6557963011489792: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/fuzz/bplist-crashes/clusterfuzz-testcase-6557963011489792 -------------------------------------------------------------------------------- /fuzz/bplist-crashes/clusterfuzz-testcase-6605859144597504: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/fuzz/bplist-crashes/clusterfuzz-testcase-6605859144597504 -------------------------------------------------------------------------------- /fuzz/bplist-crashes/crash-0ce4dd483b645bc05ec45a97d285dcf1933ee840: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/fuzz/bplist-crashes/crash-0ce4dd483b645bc05ec45a97d285dcf1933ee840 -------------------------------------------------------------------------------- /fuzz/bplist-crashes/crash-0d59cdcb5c3416c2790612b78a631ce9f5622800: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/fuzz/bplist-crashes/crash-0d59cdcb5c3416c2790612b78a631ce9f5622800 -------------------------------------------------------------------------------- /fuzz/bplist-crashes/crash-17d635ab460fef74df1ac7561f1253533a6359c5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/fuzz/bplist-crashes/crash-17d635ab460fef74df1ac7561f1253533a6359c5 -------------------------------------------------------------------------------- /fuzz/bplist-crashes/crash-33a67313fa7864cd627ef92d12017a127d342f28: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/fuzz/bplist-crashes/crash-33a67313fa7864cd627ef92d12017a127d342f28 -------------------------------------------------------------------------------- /fuzz/bplist-crashes/crash-39f1347115f8fe9ac25cdc9332e3fc5cd32c7f7b: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/fuzz/bplist-crashes/crash-39f1347115f8fe9ac25cdc9332e3fc5cd32c7f7b -------------------------------------------------------------------------------- /fuzz/bplist-crashes/crash-4bd78175fe01d07c5ee90104fbc68d95dd092210: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/fuzz/bplist-crashes/crash-4bd78175fe01d07c5ee90104fbc68d95dd092210 -------------------------------------------------------------------------------- /fuzz/bplist-crashes/crash-4c5404453bb7425aef9b953a5f6f3f0afcc48392: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/fuzz/bplist-crashes/crash-4c5404453bb7425aef9b953a5f6f3f0afcc48392 -------------------------------------------------------------------------------- /fuzz/bplist-crashes/crash-52775e25f6af20af351cd616834e602fc988a032: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/fuzz/bplist-crashes/crash-52775e25f6af20af351cd616834e602fc988a032 -------------------------------------------------------------------------------- /fuzz/bplist-crashes/crash-6d1399685b745d3d49fadc91072fabcdde8d16fa: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/fuzz/bplist-crashes/crash-6d1399685b745d3d49fadc91072fabcdde8d16fa -------------------------------------------------------------------------------- /fuzz/bplist-crashes/crash-94b3725900d63c6258448fd757559c81002de9c9: -------------------------------------------------------------------------------- 1 | bplist00`% -------------------------------------------------------------------------------- /fuzz/bplist-crashes/crash-a47195acbabc3f5b2cda9c6ebda42f2afc1cc5af: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/fuzz/bplist-crashes/crash-a47195acbabc3f5b2cda9c6ebda42f2afc1cc5af -------------------------------------------------------------------------------- /fuzz/bplist-crashes/crash-ce852bae6aeeffc4698a93660236f1b995ce966e: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/fuzz/bplist-crashes/crash-ce852bae6aeeffc4698a93660236f1b995ce966e -------------------------------------------------------------------------------- /fuzz/bplist-crashes/crash-daddb6e82e3d1ed76e20e4131462f5247a6fb131: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/fuzz/bplist-crashes/crash-daddb6e82e3d1ed76e20e4131462f5247a6fb131 -------------------------------------------------------------------------------- /fuzz/bplist-crashes/crash-f21be4ebce7f9c337bf96b93cec7e252f5c75a21: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/fuzz/bplist-crashes/crash-f21be4ebce7f9c337bf96b93cec7e252f5c75a21 -------------------------------------------------------------------------------- /fuzz/bplist-crashes/crash-f779dafccc0164684d1a264976e56037188b40e2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/fuzz/bplist-crashes/crash-f779dafccc0164684d1a264976e56037188b40e2 -------------------------------------------------------------------------------- /fuzz/bplist-leaks/leak-96fb453b3ba18d31e164831795a708183b5a0dac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/fuzz/bplist-leaks/leak-96fb453b3ba18d31e164831795a708183b5a0dac -------------------------------------------------------------------------------- /fuzz/bplist-leaks/leak-acb3c00a83d7635638a476a4e70fc1f1caa1a5b1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/fuzz/bplist-leaks/leak-acb3c00a83d7635638a476a4e70fc1f1caa1a5b1 -------------------------------------------------------------------------------- /fuzz/bplist-leaks/leak-fe2cd4b1f67e0c9b21e6225a4fb4ca19eab80074: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/fuzz/bplist-leaks/leak-fe2cd4b1f67e0c9b21e6225a4fb4ca19eab80074 -------------------------------------------------------------------------------- /fuzz/bplist.dict: -------------------------------------------------------------------------------- 1 | header_bplist = "bplist00" 2 | -------------------------------------------------------------------------------- /fuzz/bplist_fuzzer.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * bplist_fuzzer.cc 3 | * binary plist fuzz target for libFuzzer 4 | * 5 | * Copyright (c) 2017 Nikias Bassen All Rights Reserved. 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #include 23 | #include 24 | 25 | extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) 26 | { 27 | plist_t root_node = NULL; 28 | plist_from_bin(reinterpret_cast(data), size, &root_node); 29 | plist_free(root_node); 30 | 31 | return 0; 32 | } 33 | -------------------------------------------------------------------------------- /fuzz/bplist_fuzzer.options: -------------------------------------------------------------------------------- 1 | [libfuzzer] 2 | max_len = 4096 3 | dict = bplist.dict 4 | -------------------------------------------------------------------------------- /fuzz/fuzzers.test: -------------------------------------------------------------------------------- 1 | ## -*- sh -*- 2 | 3 | set -e 4 | 5 | ./init-fuzzers.sh 6 | 7 | ./test-fuzzers.sh 8 | 9 | -------------------------------------------------------------------------------- /fuzz/init-fuzzers.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | CURDIR=`pwd` 4 | FUZZDIR=`dirname $0` 5 | 6 | cd ${FUZZDIR} 7 | 8 | if ! test -x xplist_fuzzer || ! test -x bplist_fuzzer || ! test -x jplist_fuzzer; then 9 | echo "ERROR: you need to build the fuzzers first." 10 | cd ${CURDIR} 11 | exit 1 12 | fi 13 | 14 | mkdir -p xplist-input 15 | cp ../test/data/*.plist xplist-input/ 16 | ./xplist_fuzzer -merge=1 xplist-input xplist-crashes xplist-leaks -dict=xplist.dict 17 | 18 | mkdir -p bplist-input 19 | cp ../test/data/*.bplist bplist-input/ 20 | ./bplist_fuzzer -merge=1 bplist-input bplist-crashes bplist-leaks -dict=bplist.dict 21 | 22 | mkdir -p jplist-input 23 | mkdir -p jplist-crashes 24 | mkdir -p jplist-leaks 25 | cp ../test/data/j1.plist jplist-input/ 26 | cp ../test/data/j2.plist jplist-input/ 27 | ./jplist_fuzzer -merge=1 jplist-input jplist-crashes jplist-leaks -dict=jplist.dict 28 | 29 | mkdir -p oplist-input 30 | mkdir -p oplist-crashes 31 | mkdir -p oplist-leaks 32 | cp ../test/data/*.ostep oplist-input/ 33 | cp ../test/data/test.strings oplist-input/ 34 | ./oplist_fuzzer -merge=1 oplist-input oplist-crashes oplist-leaks -dict=oplist.dict 35 | 36 | cd ${CURDIR} 37 | exit 0 38 | -------------------------------------------------------------------------------- /fuzz/jplist-crashes/clusterfuzz-testcase-minimized-jplist_fuzzer-4997614678966272: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/fuzz/jplist-crashes/clusterfuzz-testcase-minimized-jplist_fuzzer-4997614678966272 -------------------------------------------------------------------------------- /fuzz/jplist-crashes/clusterfuzz-testcase-minimized-jplist_fuzzer-5149455463088128: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/fuzz/jplist-crashes/clusterfuzz-testcase-minimized-jplist_fuzzer-5149455463088128 -------------------------------------------------------------------------------- /fuzz/jplist-crashes/clusterfuzz-testcase-minimized-jplist_fuzzer-5161359598288896: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/fuzz/jplist-crashes/clusterfuzz-testcase-minimized-jplist_fuzzer-5161359598288896 -------------------------------------------------------------------------------- /fuzz/jplist-crashes/clusterfuzz-testcase-minimized-jplist_fuzzer-5486807695884288: -------------------------------------------------------------------------------- 1 | 3 -------------------------------------------------------------------------------- /fuzz/jplist-crashes/clusterfuzz-testcase-minimized-jplist_fuzzer-5576833398079488: -------------------------------------------------------------------------------- 1 | {""f ""}{""[""""""]""}{""[""""""]""}{""[""""""]""[""""""]""}{""[""""""]""}{""[""""""]""}{""[""""""]""{""}{""[""""""]""}{""[""""""]""}{""[""""]""}{""[""""""]""}{""[""""""]""}{""[""""""{""}{""[""""""]""}{""[""""""]""}{""[""""""]""}{""[""""]""}{""[""""{""[""]""}{""[""""""]""}{""[""""""]""}{""}{""}{""}{""}{""[""""""]""}{""[""""""]}{""[""""]""}{""[""""]""}{""}{""[""""""]""}""]}{""[""""""]""}{""}{""}{""[""""""]""}{""[""""]}]}{""[""""""]""}{""[""""""]""}{""}{""[""""""]""}} -------------------------------------------------------------------------------- /fuzz/jplist-crashes/clusterfuzz-testcase-minimized-jplist_fuzzer-5704016686874624: -------------------------------------------------------------------------------- 1 | {"Some Ak this: \u-170141183460469231731687303715884040192 !!!"} -------------------------------------------------------------------------------- /fuzz/jplist-crashes/clusterfuzz-testcase-minimized-jplist_fuzzer-6639076466360320: -------------------------------------------------------------------------------- 1 | - -------------------------------------------------------------------------------- /fuzz/jplist-leaks/clusterfuzz-testcase-minimized-jplist_fuzzer-4881933237092352: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/fuzz/jplist-leaks/clusterfuzz-testcase-minimized-jplist_fuzzer-4881933237092352 -------------------------------------------------------------------------------- /fuzz/jplist-leaks/clusterfuzz-testcase-minimized-jplist_fuzzer-5069883912617984: -------------------------------------------------------------------------------- 1 | {""A} -------------------------------------------------------------------------------- /fuzz/jplist-leaks/clusterfuzz-testcase-minimized-jplist_fuzzer-5816111696838656: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/fuzz/jplist-leaks/clusterfuzz-testcase-minimized-jplist_fuzzer-5816111696838656 -------------------------------------------------------------------------------- /fuzz/jplist.dict: -------------------------------------------------------------------------------- 1 | # 2 | # AFL dictionary for JSON 3 | # ----------------------- 4 | # 5 | # Just the very basics. 6 | # 7 | # Inspired by a dictionary by Jakub Wilk 8 | # 9 | 10 | "0" 11 | ",0" 12 | ":0" 13 | "0:" 14 | "-1.2e+3" 15 | 16 | "true" 17 | "false" 18 | "null" 19 | 20 | "\"\"" 21 | ",\"\"" 22 | ":\"\"" 23 | "\"\":" 24 | 25 | "{}" 26 | ",{}" 27 | ":{}" 28 | "{\"\":0}" 29 | "{{}}" 30 | 31 | "[]" 32 | ",[]" 33 | ":[]" 34 | "[0]" 35 | "[[]]" 36 | 37 | "''" 38 | "\\" 39 | "\\b" 40 | "\\f" 41 | "\\n" 42 | "\\r" 43 | "\\t" 44 | "\\u0000" 45 | "\\x00" 46 | "\\0" 47 | "\\uD800\\uDC00" 48 | "\\uDBFF\\uDFFF" 49 | 50 | "\"\":0" 51 | "//" 52 | "/**/" 53 | -------------------------------------------------------------------------------- /fuzz/jplist_fuzzer.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * jplist_fuzzer.cc 3 | * JSON plist fuzz target for libFuzzer 4 | * 5 | * Copyright (c) 2021 Nikias Bassen All Rights Reserved. 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #include 23 | #include 24 | 25 | extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) 26 | { 27 | plist_t root_node = NULL; 28 | plist_from_json(reinterpret_cast(data), size, &root_node); 29 | plist_free(root_node); 30 | 31 | return 0; 32 | } 33 | -------------------------------------------------------------------------------- /fuzz/jplist_fuzzer.options: -------------------------------------------------------------------------------- 1 | [libfuzzer] 2 | max_len = 4096 3 | dict = jplist.dict 4 | -------------------------------------------------------------------------------- /fuzz/oplist-crashes/clusterfuzz-testcase-minimized-oplist_fuzzer-4503815405830144: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/fuzz/oplist-crashes/clusterfuzz-testcase-minimized-oplist_fuzzer-4503815405830144 -------------------------------------------------------------------------------- /fuzz/oplist-crashes/clusterfuzz-testcase-minimized-oplist_fuzzer-4683683569467392: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/fuzz/oplist-crashes/clusterfuzz-testcase-minimized-oplist_fuzzer-4683683569467392 -------------------------------------------------------------------------------- /fuzz/oplist-crashes/clusterfuzz-testcase-minimized-oplist_fuzzer-4716194114699264: -------------------------------------------------------------------------------- 1 | (< -------------------------------------------------------------------------------- /fuzz/oplist-crashes/clusterfuzz-testcase-minimized-oplist_fuzzer-4789915626110976: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/fuzz/oplist-crashes/clusterfuzz-testcase-minimized-oplist_fuzzer-4789915626110976 -------------------------------------------------------------------------------- /fuzz/oplist-leaks/clusterfuzz-testcase-minimized-oplist_fuzzer-6043548602728448: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/fuzz/oplist-leaks/clusterfuzz-testcase-minimized-oplist_fuzzer-6043548602728448 -------------------------------------------------------------------------------- /fuzz/oplist-leaks/clusterfuzz-testcase-minimized-oplist_fuzzer-6497436988473344: -------------------------------------------------------------------------------- 1 | " -------------------------------------------------------------------------------- /fuzz/oplist.dict: -------------------------------------------------------------------------------- 1 | # 2 | # AFL dictionary for OpenStep plist format 3 | # ---------------------------------------- 4 | 5 | "0" 6 | ",0" 7 | "=0" 8 | "0=" 9 | 10 | "\"\"" 11 | ",\"\"" 12 | "=\"\"" 13 | "\"\"=" 14 | 15 | "=" 16 | ";" 17 | 18 | "{}" 19 | ",{}" 20 | "={}" 21 | "{\"\"=0}" 22 | "{{}}" 23 | 24 | "()" 25 | ",()" 26 | "=()" 27 | "(0)" 28 | "(())" 29 | 30 | "''" 31 | "\\" 32 | "\\b" 33 | "\\f" 34 | "\\n" 35 | "\\r" 36 | "\\t" 37 | "\\U0000" 38 | "\\a" 39 | "\\b" 40 | "\\f" 41 | "\\n" 42 | "\\r" 43 | "\\t" 44 | "\\v" 45 | "\\0" 46 | "\\uD800\\uDC00" 47 | "\\uDBFF\\uDFFF" 48 | 49 | "\"\"=0" 50 | "//" 51 | "/**/" 52 | -------------------------------------------------------------------------------- /fuzz/oplist_fuzzer.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * oplist_fuzzer.cc 3 | * OpenStep plist fuzz target for libFuzzer 4 | * 5 | * Copyright (c) 2023 Nikias Bassen All Rights Reserved. 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #include 23 | #include 24 | 25 | extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) 26 | { 27 | plist_t root_node = NULL; 28 | plist_from_openstep(reinterpret_cast(data), size, &root_node); 29 | plist_free(root_node); 30 | 31 | return 0; 32 | } 33 | -------------------------------------------------------------------------------- /fuzz/oplist_fuzzer.options: -------------------------------------------------------------------------------- 1 | [libfuzzer] 2 | max_len = 4096 3 | dict = oplist.dict 4 | -------------------------------------------------------------------------------- /fuzz/test-fuzzers.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | CURDIR=`pwd` 4 | FUZZDIR=`dirname $0` 5 | 6 | cd ${FUZZDIR} 7 | 8 | if ! test -x xplist_fuzzer || ! test -x bplist_fuzzer || ! test -x jplist_fuzzer || ! test -x oplist_fuzzer; then 9 | echo "ERROR: you need to build the fuzzers first." 10 | cd ${CURDIR} 11 | exit 1 12 | fi 13 | 14 | if ! test -d xplist-input || ! test -d bplist-input || ! test -d jplist-input || ! test -d oplist-input; then 15 | echo "ERROR: fuzzer corpora directories are not present. Did you run init-fuzzers.sh ?" 16 | cd ${CURDIR} 17 | exit 1 18 | fi 19 | 20 | echo "### TESTING xplist_fuzzer ###" 21 | if ! ./xplist_fuzzer xplist-input -dict=xplist.dict -max_len=65536 -runs=10000; then 22 | cd ${CURDIR} 23 | exit 1 24 | fi 25 | 26 | echo "### TESTING bplist_fuzzer ###" 27 | if ! ./bplist_fuzzer bplist-input -dict=bplist.dict -max_len=4096 -runs=10000; then 28 | cd ${CURDIR} 29 | exit 1 30 | fi 31 | 32 | echo "### TESTING jplist_fuzzer ###" 33 | if ! ./jplist_fuzzer jplist-input -dict=jplist.dict -max_len=65536 -runs=10000; then 34 | cd ${CURDIR} 35 | exit 1 36 | fi 37 | 38 | echo "### TESTING oplist_fuzzer ###" 39 | if ! ./oplist_fuzzer oplist-input -dict=oplist.dict -max_len=65536 -runs=10000; then 40 | cd ${CURDIR} 41 | exit 1 42 | fi 43 | 44 | cd ${CURDIR} 45 | exit 0 46 | -------------------------------------------------------------------------------- /fuzz/xplist-crashes/clusterfuzz-testcase-4516959125241856: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/fuzz/xplist-crashes/clusterfuzz-testcase-4516959125241856 -------------------------------------------------------------------------------- /fuzz/xplist-crashes/clusterfuzz-testcase-4663876528373760: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | /EN" "http://www.apple.com/DTDs========================/PropertyList-1.0. 5 | 6 | -------------------------------------------------------------------------------- /fuzz/xplist-crashes/clusterfuzz-testcase-5799076113154048: -------------------------------------------------------------------------------- 1 | 2 | test 3 | ://www.apple.com/D|Ds/Prst-1.0.dtd"> 4 | 5 | 6 | Time1 7 | 8 | Time1 9 | 10 | Time1 11 | 12 | CF$UID 13 | 14 | Time1 15 | 16 | Time1 17 | 18 | Time1 19 | 20 | Time1 21 | 22 | Time1 23 | 24 | Time1 25 | 26 | Time1 27 | 28 | Time1 29 | 30 | Time1 31 | 32 | Time1 33 | 34 | Time1 35 | 36 | Time1 37 | 38 | Time1 39 | 2010-11-12T13:14:15Z 40 | Time2 41 | 2008-07-06T05:04:03Z 42 | Time3 43 | 1869-01-03T08:16:32Z 44 | Time4 45 | -------------------------------------------------------------------------------- /fuzz/xplist-crashes/clusterfuzz-testcase-5922404220010496: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/fuzz/xplist-crashes/clusterfuzz-testcase-5922404220010496 -------------------------------------------------------------------------------- /fuzz/xplist-crashes/clusterfuzz-testcase-6015098361479168: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Some ASCII string 6 | 7 | Some UTF8 stnrigs 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | Some Int 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | Some Int 27 | 28 | 29 | 30 | Some Data 31 | 32 | 33 | Some Date 34 | <> 35 | 36 | e> 37 | 38 | Some Data 39 | 40 | 41 | 42 | ncoding="UTF-8"?> 43 | 44 | 45 | Some ASCII string 46 | 47 | Some UTF8 strings 48 | 49 | EEEEEEEEEEEEEEEEEEE 50 | Keys & "entities" 51 | Boolean2/Some Real 52 | 53 | Some Date 54 | 55 | Some Data 56 | 57 | 58 | Some Date 59 | <> 60 | 61 | e> 62 | 63 | Some Data 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /fuzz/xplist-crashes/clusterfuzz-testcase-6043836860071936: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/fuzz/xplist-crashes/clusterfuzz-testcase-6043836860071936 -------------------------------------------------------------------------------- /fuzz/xplist-crashes/clusterfuzz-testcase-6482601374121984: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/fuzz/xplist-crashes/clusterfuzz-testcase-6482601374121984 -------------------------------------------------------------------------------- /fuzz/xplist-crashes/crash-09788d7acb46b4b177422f9c4ee54556a3ad1f17: -------------------------------------------------------------------------------- 1 | 2 | 3 | some test entitites 4 | 5 | copyright 6 | © 7 | multiple entitites 8 | ⼠⼡⼢ 9 | multiple entitites with characters inbetween 10 | a⼣b⼤c⼥d 11 | 12 | one byte entity 13 | 14 | one byte entity 15 | @ 16 | one byte entity with text after 17 | @z 18 | one byte entity with text before 19 | a@ 20 | one byte entity with text before & after 21 | a@z 22 | 23 | two-byte utf-8 24 | 25 | two-byte utf-8 26 | Ä 27 | two-byte utf-8 with text after 28 | Ëyz 29 | two-byte utf-8 with text before 30 | abÖ 31 | two-byte utf-8 with text before & after 32 | abÜyz 33 | 34 | three byte utf-8 35 | 36 | three byte utf-8 37 | 38 | three byte utf-8 with text after 39 | £xyz 40 | three byte utf-8 with text bef&a; 41 | abc¥ 42 | three byte utf-8 with text before & after 43 | (abc₩xyz 44 | 45 | four byte utf-8 46 | 47 | four byte utf-8 48 | 𝕢 49 | with text before & after 50 | abcd𝕥wxyz 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /fuzz/xplist-crashes/crash-155c60d5c4b2778110fb4a633caa7d64eb9b99c1: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2 | 3 | 4 | 5 | -1 6 | 18446744073709551615 7 | 9223372036854775807 8 | -9223372036854775808 9 | 9223372036854775808 10 | 11 | 12 | -------------------------------------------------------------------------------- /fuzz/xplist-crashes/crash-7bc172e27a2b1d4fcaf031f59d1f08fb83081e4a: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Time1 6 | 2010-11-12T13:14:15Z 7 | Time2 8 | 4016-07-0-11 6 | empty key with comment 7 | 8 | 9 | -------------------------------------------------------------------------------- /test/data/entities.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | some test entitites 4 | 5 | copyright 6 | © 7 | multiple entitites 8 | ⼠⼡⼢ 9 | multiple entitites with characters inbetween 10 | a⼣b⼤c⼥d 11 | 12 | one byte entity 13 | 14 | one byte entity 15 | @ 16 | one byte entity with text after 17 | @z 18 | one byte entity with text before 19 | a@ 20 | one byte entity with text before & after 21 | a@z 22 | 23 | two-byte utf-8 24 | 25 | two-byte utf-8 26 | Ä 27 | two-byte utf-8 with text after 28 | Ëyz 29 | two-byte utf-8 with text before 30 | abÖ 31 | two-byte utf-8 with text before & after 32 | abÜyz 33 | 34 | three byte utf-8 35 | 36 | three byte utf-8 37 | 38 | three byte utf-8 with text after 39 | £xyz 40 | three byte utf-8 with text before 41 | abc¥ 42 | three byte utf-8 with text before & after 43 | abc₩xyz 44 | 45 | four byte utf-8 46 | 47 | four byte utf-8 48 | 𝕢 49 | four byte utf-8 with text after 50 | 𝕣wxyz 51 | four byte utf-8 with text before 52 | abcd𝕤 53 | four byte utf-8 with text before & after 54 | abcd𝕥wxyz 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /test/data/hex.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 0x73709551615 5 | 6 | -------------------------------------------------------------------------------- /test/data/int64_min_max.json: -------------------------------------------------------------------------------- 1 | {"INT64_MIN":-9223372036854775808,"INT64_MAX":9223372036854775807} -------------------------------------------------------------------------------- /test/data/invalid_tag.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | test 4 | value 5 | 6 | 7 | -------------------------------------------------------------------------------- /test/data/j1.json: -------------------------------------------------------------------------------- 1 | {"test":[1,1],"foo":[[-1337],[1],[1],[1],[[1],[1],[1],[1],[[1],[1],[1],[1]]]],"more":{"a":"yo","b":[{"c":0.25},{"a":"yo","b":[{"c":0.25},{"a":"yo","b":[{"c":-0.25}]}]}]}} 2 | -------------------------------------------------------------------------------- /test/data/j2.json: -------------------------------------------------------------------------------- 1 | {"Some ASCII string":"Test ASCII String","Some UTF8 strings":["àéèçù","日本語","汉语/漢語","한국어/조선말","русский язык","الْعَرَبيّة","עִבְרִית","język polski","हिन्दी"],"Keys & \"entities\"":"hellow world & others are \"fun!?'","Boolean":false,"Another Boolean":true,"Some Int":32434543632,"Some String with Unicode entity":"Yeah check this: \u1234 !!!"} -------------------------------------------------------------------------------- /test/data/malformed_dict.bplist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/test/data/malformed_dict.bplist -------------------------------------------------------------------------------- /test/data/o1.ostep: -------------------------------------------------------------------------------- 1 | { 2 | "test" = (1,1); 3 | foo = ( 4 | (-1337), 5 | (1), 6 | (1), 7 | (1), 8 | ( 9 | (1), 10 | (1), 11 | (1), 12 | (1), 13 | ( 14 | (1), 15 | (1), 16 | (1), 17 | (1) 18 | ) 19 | ) 20 | ); 21 | more = { 22 | "a" = "yo"; 23 | "b" = ( 24 | { 25 | "c" = 0.25; 26 | }, 27 | { 28 | "a" = "yo"; 29 | "b" = ( 30 | { 31 | "c" = 0.25; 32 | }, 33 | { 34 | "a" = "yo"; 35 | "b" = ( 36 | { 37 | "cd" = -0.25; 38 | } 39 | ); 40 | } 41 | ); 42 | } 43 | ); 44 | }; 45 | } 46 | -------------------------------------------------------------------------------- /test/data/o2.ostep: -------------------------------------------------------------------------------- 1 | { 2 | "Some ASCII string" = "Test ASCII String"; 3 | "Some UTF8 strings" = ( 4 | "àéèçù", 5 | "日本語", 6 | "汉语/漢語", 7 | "한국어/조선말", 8 | "русский язык", 9 | "الْعَرَبيّة", 10 | "עִבְרִית", 11 | "język polski", 12 | "हिन्दी", 13 | ); 14 | "Keys & \"entities\"" = "hello world & others are fun!?'"; 15 | "Some Int" = 32434543632; 16 | "Some String with Unicode entity" = "Yeah check this: \U1234 !!!"; 17 | } 18 | -------------------------------------------------------------------------------- /test/data/o3.ostep: -------------------------------------------------------------------------------- 1 | ( 2 | { 3 | AFirstKey = "A First Value"; 4 | ASecondKey = "A Second Value"; 5 | // this is the last entry 6 | }, 7 | /*{ 8 | BFirstKey = "B First Value"; 9 | BSecondKey = "B Second Value"; 10 | },*/ 11 | { 12 | CFirstKey = "C First Value"; // "C First Unused Value"; 13 | // now here is another comment 14 | CSecondKey = /* "C Second Value";*/ "C Second Corrected Value"; 15 | } 16 | ) 17 | -------------------------------------------------------------------------------- /test/data/off1byte.bplist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/test/data/off1byte.bplist -------------------------------------------------------------------------------- /test/data/off2bytes.bplist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/test/data/off2bytes.bplist -------------------------------------------------------------------------------- /test/data/off3bytes.bplist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/test/data/off3bytes.bplist -------------------------------------------------------------------------------- /test/data/off4bytes.bplist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/test/data/off4bytes.bplist -------------------------------------------------------------------------------- /test/data/off5bytes.bplist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/test/data/off5bytes.bplist -------------------------------------------------------------------------------- /test/data/off6bytes.bplist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/test/data/off6bytes.bplist -------------------------------------------------------------------------------- /test/data/off7bytes.bplist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/test/data/off7bytes.bplist -------------------------------------------------------------------------------- /test/data/off8bytes.bplist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/test/data/off8bytes.bplist -------------------------------------------------------------------------------- /test/data/offxml.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | A 6 | B 7 | 8 | 9 | -------------------------------------------------------------------------------- /test/data/order.bplist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/test/data/order.bplist -------------------------------------------------------------------------------- /test/data/order.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | test 6 | 7 | 1 8 | 1 9 | 10 | foo 11 | 12 | 13 | 1 14 | 15 | 16 | test 17 | foo 18 | 19 | 20 | 1 21 | 22 | 23 | 1 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /test/data/recursion.bplist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/test/data/recursion.bplist -------------------------------------------------------------------------------- /test/data/signed.bplist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/test/data/signed.bplist -------------------------------------------------------------------------------- /test/data/signed.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -1 5 | 6 | -------------------------------------------------------------------------------- /test/data/signedunsigned.bplist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/test/data/signedunsigned.bplist -------------------------------------------------------------------------------- /test/data/signedunsigned.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -1 6 | 18446744073709551615 7 | 9223372036854775807 8 | -9223372036854775808 9 | 9223372036854775808 10 | 11 | 12 | -------------------------------------------------------------------------------- /test/data/test.strings: -------------------------------------------------------------------------------- 1 | STRINGS_ENTRY = "Whatever"; 2 | FOO = "BAR"; 3 | BAR = Foo; 4 | ENTRY0 = "àéèçù"; 5 | ENTRY1 = "日本語"; 6 | ENTRY2 = "汉语/漢語"; 7 | ENTRY3 = "한국어/조선말"; 8 | ENTRY4 = "русский язык"; 9 | ENTRY5 = "الْعَرَبيّة"; 10 | ENTRY6 = "עִבְרִית"; 11 | ENTRY7 = "język polski"; 12 | ENTRY8 = "हिन्दी"; 13 | -------------------------------------------------------------------------------- /test/data/uid.bplist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/test/data/uid.bplist -------------------------------------------------------------------------------- /test/data/unsigned.bplist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libimobiledevice/libplist/cf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c/test/data/unsigned.bplist -------------------------------------------------------------------------------- /test/data/unsigned.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18446744073709551615 5 | 6 | -------------------------------------------------------------------------------- /test/dates.test: -------------------------------------------------------------------------------- 1 | ## -*- sh -*- 2 | 3 | set -e 4 | 5 | DATASRC=$top_srcdir/test/data 6 | TESTFILE=7.plist 7 | DATAIN0=$DATASRC/$TESTFILE 8 | DATAOUT0=$top_builddir/test/data/dates.test.bin 9 | DATAOUT1=$top_builddir/test/data/dates.test.xml 10 | 11 | $top_builddir/tools/plistutil -i $DATAIN0 -o $DATAOUT0 12 | $top_builddir/tools/plistutil -i $DATAOUT0 -o $DATAOUT1 13 | 14 | $top_builddir/test/plist_cmp $DATAOUT0 $DATAIN0 15 | $top_builddir/test/plist_cmp $DATAOUT1 $DATAIN0 16 | -------------------------------------------------------------------------------- /test/empty++.test: -------------------------------------------------------------------------------- 1 | ## -*- sh -*- 2 | 3 | DATASRC=$top_srcdir/test/data 4 | DATAOUT=$top_builddir/test/data 5 | TESTFILE=1.plist 6 | 7 | if ! test -d "$DATAOUT"; then 8 | mkdir -p $DATAOUT 9 | fi 10 | 11 | echo "Converting" 12 | $top_builddir/test/plist_test++ $DATASRC/$TESTFILE $DATAOUT/empty++.test.out 13 | 14 | echo "Comparing" 15 | $top_builddir/test/plist_cmp $DATASRC/$TESTFILE $DATAOUT/empty++.test.out 16 | -------------------------------------------------------------------------------- /test/empty.test: -------------------------------------------------------------------------------- 1 | ## -*- sh -*- 2 | 3 | DATASRC=$top_srcdir/test/data 4 | DATAOUT=$top_builddir/test/data 5 | TESTFILE=1.plist 6 | 7 | if ! test -d "$DATAOUT"; then 8 | mkdir -p $DATAOUT 9 | fi 10 | 11 | echo "Converting" 12 | $top_builddir/test/plist_test $DATASRC/$TESTFILE $DATAOUT/empty.test.out 13 | 14 | echo "Comparing" 15 | $top_builddir/test/plist_cmp $DATASRC/$TESTFILE $DATAOUT/empty.test.out 16 | -------------------------------------------------------------------------------- /test/empty_keys.test: -------------------------------------------------------------------------------- 1 | ## -*- sh -*- 2 | 3 | set -e 4 | 5 | DATASRC=$top_srcdir/test/data 6 | TESTFILE=empty_keys.plist 7 | DATAIN0=$DATASRC/$TESTFILE 8 | DATAOUT0=$top_builddir/test/data/empty_keys.test.bin 9 | 10 | $top_builddir/tools/plistutil -i $DATAIN0 -o $DATAOUT0 11 | 12 | $top_builddir/test/plist_cmp $DATAIN0 $DATAOUT0 13 | -------------------------------------------------------------------------------- /test/entities.test: -------------------------------------------------------------------------------- 1 | ## -*- sh -*- 2 | 3 | set -e 4 | 5 | DATASRC=$top_srcdir/test/data 6 | TESTFILE=entities.plist 7 | DATAIN0=$DATASRC/$TESTFILE 8 | DATAOUT0=$top_builddir/test/data/entities.test.bin 9 | 10 | $top_builddir/tools/plistutil -i $DATAIN0 -o $DATAOUT0 11 | 12 | $top_builddir/test/plist_cmp $DATAIN0 $DATAOUT0 13 | -------------------------------------------------------------------------------- /test/hex.test: -------------------------------------------------------------------------------- 1 | ## -*- sh -*- 2 | 3 | set -e 4 | 5 | DATASRC=$top_srcdir/test/data 6 | TESTFILE=hex.plist 7 | DATAIN0=$DATASRC/$TESTFILE 8 | DATAOUT0=$top_builddir/test/data/hex.test.bin 9 | 10 | $top_builddir/tools/plistutil -i $DATAIN0 -o $DATAOUT0 11 | 12 | $top_builddir/test/plist_cmp $DATAIN0 $DATAOUT0 13 | -------------------------------------------------------------------------------- /test/huge++.test: -------------------------------------------------------------------------------- 1 | ## -*- sh -*- 2 | 3 | DATASRC=$top_srcdir/test/data 4 | DATAOUT=$top_builddir/test/data 5 | TESTFILE=5.plist 6 | 7 | if ! test -d "$DATAOUT"; then 8 | mkdir -p $DATAOUT 9 | fi 10 | 11 | echo "Converting" 12 | $top_builddir/test/plist_test++ $DATASRC/$TESTFILE $DATAOUT/huge++.test.out 13 | 14 | echo "Comparing" 15 | $top_builddir/test/plist_cmp $DATASRC/$TESTFILE $DATAOUT/huge++.test.out 16 | -------------------------------------------------------------------------------- /test/huge.test: -------------------------------------------------------------------------------- 1 | ## -*- sh -*- 2 | 3 | DATASRC=$top_srcdir/test/data 4 | DATAOUT=$top_builddir/test/data 5 | TESTFILE=5.plist 6 | 7 | if ! test -d "$DATAOUT"; then 8 | mkdir -p $DATAOUT 9 | fi 10 | 11 | echo "Converting" 12 | $top_builddir/test/plist_test $DATASRC/$TESTFILE $DATAOUT/huge.test.out 13 | 14 | echo "Comparing" 15 | $top_builddir/test/plist_cmp $DATASRC/$TESTFILE $DATAOUT/huge.test.out 16 | -------------------------------------------------------------------------------- /test/integer_set.test: -------------------------------------------------------------------------------- 1 | ## -*- sh -*- 2 | 3 | set -e 4 | 5 | $top_builddir/test/integer_set_test 6 | -------------------------------------------------------------------------------- /test/invalid_tag.test: -------------------------------------------------------------------------------- 1 | ## -*- sh -*- 2 | 3 | DATASRC=$top_srcdir/test/data 4 | TESTFILE=invalid_tag.plist 5 | DATAIN0=$DATASRC/$TESTFILE 6 | DATAOUT0=$top_builddir/test/data/invalid_tag.test.out 7 | 8 | rm -rf $DATAOUT0 9 | $top_builddir/tools/plistutil -i $DATAIN0 -o $DATAOUT0 10 | 11 | # test succeeds if plistutil fails 12 | if [ $? -eq 0 ]; then 13 | exit 1 14 | else 15 | exit 0 16 | fi 17 | -------------------------------------------------------------------------------- /test/json-int64-min-max.test: -------------------------------------------------------------------------------- 1 | ## -*- sh -*- 2 | 3 | set -e 4 | 5 | DATASRC=$top_srcdir/test/data 6 | DATAOUT=$top_builddir/test/data 7 | TESTFILE=int64_min_max.json 8 | 9 | if ! test -d "$DATAOUT"; then 10 | mkdir -p $DATAOUT 11 | fi 12 | 13 | export PLIST_JSON_DEBUG=1 14 | 15 | echo "Converting" 16 | $top_builddir/test/plist_jtest $DATASRC/$TESTFILE $DATAOUT/json-int64-min-max.test.out 17 | 18 | echo "Comparing" 19 | $top_builddir/test/plist_cmp $DATASRC/$TESTFILE $DATAOUT/json-int64-min-max.test.out 20 | -------------------------------------------------------------------------------- /test/json-invalid-types.test: -------------------------------------------------------------------------------- 1 | ## -*- sh -*- 2 | 3 | DATASRC=$top_srcdir/test/data 4 | DATAOUT=$top_builddir/test/data 5 | TESTFILE0=data.bplist 6 | TESTFILE1=7.plist 7 | TESTFILE2=uid.bplist 8 | 9 | if ! test -d "$DATAOUT"; then 10 | mkdir -p $DATAOUT 11 | fi 12 | 13 | export PLIST_JSON_DEBUG=1 14 | 15 | echo "Converting (failure expected)" 16 | $top_builddir/tools/plistutil -f json -i $DATASRC/$TESTFILE0 -o /dev/null 17 | if [ $? -neq 2 ]; then 18 | exit 1 19 | fi 20 | 21 | echo "Converting (failure expected)" 22 | $top_builddir/tools/plistutil -f json -i $DATASRC/$TESTFILE1 -o /dev/null 23 | if [ $? -neq 2 ]; then 24 | exit 2 25 | fi 26 | 27 | echo "Converting (failure expected)" 28 | $top_builddir/tools/plistutil -f json -i $DATASRC/$TESTFILE2 -o /dev/null 29 | if [ $? -neq 2 ]; then 30 | exit 3 31 | fi 32 | 33 | exit 0 34 | -------------------------------------------------------------------------------- /test/json1.test: -------------------------------------------------------------------------------- 1 | ## -*- sh -*- 2 | 3 | set -e 4 | 5 | DATASRC=$top_srcdir/test/data 6 | DATAOUT=$top_builddir/test/data 7 | TESTFILE=j1.json 8 | 9 | if ! test -d "$DATAOUT"; then 10 | mkdir -p $DATAOUT 11 | fi 12 | 13 | export PLIST_JSON_DEBUG=1 14 | 15 | echo "Converting" 16 | $top_builddir/test/plist_jtest $DATASRC/$TESTFILE $DATAOUT/json1.test.out 17 | 18 | echo "Comparing" 19 | $top_builddir/test/plist_cmp $DATASRC/$TESTFILE $DATAOUT/json1.test.out 20 | -------------------------------------------------------------------------------- /test/json2.test: -------------------------------------------------------------------------------- 1 | ## -*- sh -*- 2 | 3 | set -e 4 | 5 | DATASRC=$top_srcdir/test/data 6 | DATAOUT=$top_builddir/test/data 7 | TESTFILE=j2.json 8 | 9 | if ! test -d "$DATAOUT"; then 10 | mkdir -p $DATAOUT 11 | fi 12 | 13 | export PLIST_JSON_DEBUG=1 14 | 15 | echo "Converting" 16 | $top_builddir/test/plist_jtest $DATASRC/$TESTFILE $DATAOUT/json2.test.out 17 | 18 | echo "Comparing" 19 | $top_builddir/test/plist_cmp $DATASRC/$TESTFILE $DATAOUT/json2.test.out 20 | -------------------------------------------------------------------------------- /test/json3.test: -------------------------------------------------------------------------------- 1 | ## -*- sh -*- 2 | 3 | set -e 4 | 5 | DATASRC=$top_srcdir/test/data 6 | DATAOUT=$top_builddir/test/data 7 | TESTFILE=entities.plist 8 | 9 | if ! test -d "$DATAOUT"; then 10 | mkdir -p $DATAOUT 11 | fi 12 | 13 | export PLIST_JSON_DEBUG=1 14 | 15 | echo "Converting input file to JSON" 16 | $top_builddir/tools/plistutil -f json -i $DATASRC/$TESTFILE -o $DATAOUT/json3.test.json 17 | 18 | echo "Converting to binary and back to JSON" 19 | $top_builddir/test/plist_jtest $DATAOUT/json3.test.json $DATAOUT/json3.test.json.out 20 | 21 | echo "Comparing" 22 | $top_builddir/test/plist_cmp $DATASRC/$TESTFILE $DATAOUT/json3.test.json.out 23 | 24 | rm -f $DATAOUT/json3.test.json 25 | -------------------------------------------------------------------------------- /test/large++.test: -------------------------------------------------------------------------------- 1 | ## -*- sh -*- 2 | 3 | DATASRC=$top_srcdir/test/data 4 | DATAOUT=$top_builddir/test/data 5 | TESTFILE=4.plist 6 | 7 | if ! test -d "$DATAOUT"; then 8 | mkdir -p $DATAOUT 9 | fi 10 | 11 | echo "Converting" 12 | $top_builddir/test/plist_test++ $DATASRC/$TESTFILE $DATAOUT/large++.test.out 13 | 14 | echo "Comparing" 15 | $top_builddir/test/plist_cmp $DATASRC/$TESTFILE $DATAOUT/large++.test.out 16 | -------------------------------------------------------------------------------- /test/large.test: -------------------------------------------------------------------------------- 1 | ## -*- sh -*- 2 | 3 | DATASRC=$top_srcdir/test/data 4 | DATAOUT=$top_builddir/test/data 5 | TESTFILE=4.plist 6 | 7 | if ! test -d "$DATAOUT"; then 8 | mkdir -p $DATAOUT 9 | fi 10 | 11 | echo "Converting" 12 | $top_builddir/test/plist_test $DATASRC/$TESTFILE $DATAOUT/large.test.out 13 | 14 | echo "Comparing" 15 | $top_builddir/test/plist_cmp $DATASRC/$TESTFILE $DATAOUT/large.test.out 16 | -------------------------------------------------------------------------------- /test/malformed_dict.test: -------------------------------------------------------------------------------- 1 | ## -*- sh -*- 2 | 3 | DATASRC=$top_srcdir/test/data 4 | TESTFILE=malformed_dict.bplist 5 | DATAIN0=$DATASRC/$TESTFILE 6 | DATAOUT0=$top_builddir/test/data/malformed_dict.test.out 7 | 8 | $top_builddir/tools/plistutil -i $DATAIN0 -o $DATAOUT0 9 | 10 | # test succeeds if plistutil fails 11 | if [ $? -eq 0 ]; then 12 | exit 1 13 | else 14 | exit 0 15 | fi 16 | -------------------------------------------------------------------------------- /test/medium++.test: -------------------------------------------------------------------------------- 1 | ## -*- sh -*- 2 | 3 | DATASRC=$top_srcdir/test/data 4 | DATAOUT=$top_builddir/test/data 5 | TESTFILE=3.plist 6 | 7 | if ! test -d "$DATAOUT"; then 8 | mkdir -p $DATAOUT 9 | fi 10 | 11 | echo "Converting" 12 | $top_builddir/test/plist_test++ $DATASRC/$TESTFILE $DATAOUT/medium++.test.out 13 | 14 | echo "Comparing" 15 | $top_builddir/test/plist_cmp $DATASRC/$TESTFILE $DATAOUT/medium++.test.out 16 | -------------------------------------------------------------------------------- /test/medium.test: -------------------------------------------------------------------------------- 1 | ## -*- sh -*- 2 | 3 | DATASRC=$top_srcdir/test/data 4 | DATAOUT=$top_builddir/test/data 5 | TESTFILE=3.plist 6 | 7 | if ! test -d "$DATAOUT"; then 8 | mkdir -p $DATAOUT 9 | fi 10 | 11 | echo "Converting" 12 | $top_builddir/test/plist_test $DATASRC/$TESTFILE $DATAOUT/medium.test.out 13 | 14 | echo "Comparing" 15 | $top_builddir/test/plist_cmp $DATASRC/$TESTFILE $DATAOUT/medium.test.out 16 | -------------------------------------------------------------------------------- /test/offsetsize.test: -------------------------------------------------------------------------------- 1 | ## -*- sh -*- 2 | 3 | set -e 4 | 5 | DATASRC=$top_srcdir/test/data 6 | TESTFILES="off1byte.bplist off2bytes.bplist off3bytes.bplist off4bytes.bplist off5bytes.bplist off6bytes.bplist off7bytes.bplist off8bytes.bplist" 7 | CMPFILE=offxml.plist 8 | 9 | for I in $TESTFILES; do 10 | echo "* checking $I" 11 | $top_builddir/test/plist_cmp $DATASRC/$I $DATASRC/$CMPFILE 12 | done 13 | -------------------------------------------------------------------------------- /test/order.test: -------------------------------------------------------------------------------- 1 | ## -*- sh -*- 2 | 3 | set -e 4 | 5 | DATASRC=$top_srcdir/test/data 6 | TESTFILE=order.bplist 7 | DATAIN0=$DATASRC/$TESTFILE 8 | DATAIN1=$DATASRC/order.plist 9 | DATAOUT0=$top_builddir/test/data/order.test.out 10 | 11 | $top_builddir/tools/plistutil -i $DATAIN0 -o $DATAOUT0 12 | 13 | $top_builddir/test/plist_cmp $DATAIN1 $DATAOUT0 14 | -------------------------------------------------------------------------------- /test/ostep-comments.test: -------------------------------------------------------------------------------- 1 | ## -*- sh -*- 2 | 3 | set -e 4 | 5 | DATASRC=$top_srcdir/test/data 6 | DATAOUT=$top_builddir/test/data 7 | TESTFILE=o3.ostep 8 | 9 | if ! test -d "$DATAOUT"; then 10 | mkdir -p $DATAOUT 11 | fi 12 | 13 | export PLIST_OSTEP_DEBUG=1 14 | 15 | echo "Converting" 16 | $top_builddir/test/plist_otest $DATASRC/$TESTFILE $DATAOUT/ostep-comments.test.out 17 | 18 | echo "Comparing" 19 | export PLIST_OSTEP_DEBUG=1 20 | $top_builddir/test/plist_cmp $DATASRC/$TESTFILE $DATAOUT/ostep-comments.test.out 21 | -------------------------------------------------------------------------------- /test/ostep-invalid-types.test: -------------------------------------------------------------------------------- 1 | ## -*- sh -*- 2 | 3 | DATASRC=$top_srcdir/test/data 4 | DATAOUT=$top_builddir/test/data 5 | TESTFILE0=data.bplist 6 | TESTFILE1=7.plist 7 | TESTFILE2=uid.bplist 8 | 9 | if ! test -d "$DATAOUT"; then 10 | mkdir -p $DATAOUT 11 | fi 12 | 13 | export PLIST_OSTEP_DEBUG=1 14 | 15 | echo "Converting (failure expected)" 16 | $top_builddir/tools/plistutil -f openstep -i $DATASRC/$TESTFILE0 -o /dev/null 17 | if [ $? -neq 2 ]; then 18 | exit 1 19 | fi 20 | 21 | echo "Converting (failure expected)" 22 | $top_builddir/tools/plistutil -f openstepn -i $DATASRC/$TESTFILE1 -o /dev/null 23 | if [ $? -neq 2 ]; then 24 | exit 2 25 | fi 26 | 27 | echo "Converting (failure expected)" 28 | $top_builddir/tools/plistutil -f openstep -i $DATASRC/$TESTFILE2 -o /dev/null 29 | if [ $? -neq 2 ]; then 30 | exit 3 31 | fi 32 | 33 | exit 0 34 | -------------------------------------------------------------------------------- /test/ostep-strings.test: -------------------------------------------------------------------------------- 1 | ## -*- sh -*- 2 | 3 | set -e 4 | 5 | DATASRC=$top_srcdir/test/data 6 | DATAOUT=$top_builddir/test/data 7 | TESTFILE=test.strings 8 | 9 | if ! test -d "$DATAOUT"; then 10 | mkdir -p $DATAOUT 11 | fi 12 | 13 | export PLIST_OSTEP_DEBUG=1 14 | 15 | echo "Converting" 16 | $top_builddir/test/plist_otest $DATASRC/$TESTFILE $DATAOUT/ostep-strings.test.out 17 | 18 | echo "Comparing" 19 | export PLIST_OSTEP_DEBUG=1 20 | $top_builddir/test/plist_cmp $DATASRC/$TESTFILE $DATAOUT/ostep-strings.test.out 21 | -------------------------------------------------------------------------------- /test/ostep1.test: -------------------------------------------------------------------------------- 1 | ## -*- sh -*- 2 | 3 | set -e 4 | 5 | DATASRC=$top_srcdir/test/data 6 | DATAOUT=$top_builddir/test/data 7 | TESTFILE=o1.ostep 8 | 9 | if ! test -d "$DATAOUT"; then 10 | mkdir -p $DATAOUT 11 | fi 12 | 13 | export PLIST_OSTEP_DEBUG=1 14 | 15 | echo "Converting" 16 | $top_builddir/test/plist_otest $DATASRC/$TESTFILE $DATAOUT/ostep1.test.out 17 | 18 | echo "Comparing" 19 | export PLIST_OSTEP_DEBUG=1 20 | $top_builddir/test/plist_cmp $DATASRC/$TESTFILE $DATAOUT/ostep1.test.out 21 | -------------------------------------------------------------------------------- /test/ostep2.test: -------------------------------------------------------------------------------- 1 | ## -*- sh -*- 2 | 3 | set -e 4 | 5 | DATASRC=$top_srcdir/test/data 6 | DATAOUT=$top_builddir/test/data 7 | TESTFILE=o2.ostep 8 | 9 | if ! test -d "$DATAOUT"; then 10 | mkdir -p $DATAOUT 11 | fi 12 | 13 | export PLIST_OTEST_DEBUG=1 14 | 15 | echo "Converting" 16 | $top_builddir/test/plist_otest $DATASRC/$TESTFILE $DATAOUT/ostep2.test.out 17 | 18 | echo "Comparing" 19 | $top_builddir/test/plist_cmp $DATASRC/$TESTFILE $DATAOUT/ostep2.test.out 20 | -------------------------------------------------------------------------------- /test/plist_btest.c: -------------------------------------------------------------------------------- 1 | /* 2 | * backup_test.c 3 | * source libplist regression test 4 | * 5 | * Copyright (c) 2009 Jonathan Beck All Rights Reserved. 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | 23 | #include "plist/plist.h" 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #ifdef _MSC_VER 31 | #pragma warning(disable:4996) 32 | #endif 33 | 34 | 35 | int main(int argc, char *argv[]) 36 | { 37 | FILE *iplist = NULL; 38 | plist_t root_node1 = NULL; 39 | plist_t root_node2 = NULL; 40 | char *plist_bin = NULL; 41 | char *plist_bin2 = NULL; 42 | char *plist_xml = NULL; 43 | int size_in = 0; 44 | uint32_t size_out = 0; 45 | uint32_t size_out2 = 0; 46 | char *file_in = NULL; 47 | char *file_out = NULL; 48 | struct stat *filestats = (struct stat *) malloc(sizeof(struct stat)); 49 | if (argc != 3) 50 | { 51 | printf("Wrong input\n"); 52 | return 1; 53 | } 54 | 55 | file_in = argv[1]; 56 | file_out = argv[2]; 57 | //read input file 58 | iplist = fopen(file_in, "rb"); 59 | 60 | if (!iplist) 61 | { 62 | printf("File does not exists\n"); 63 | return 2; 64 | } 65 | printf("File %s is open\n", file_in); 66 | stat(file_in, filestats); 67 | size_in = filestats->st_size; 68 | plist_bin = (char *) malloc(sizeof(char) * (size_in + 1)); 69 | fread(plist_bin, sizeof(char), size_in, iplist); 70 | fclose(iplist); 71 | 72 | 73 | //convert one format to another 74 | plist_from_bin(plist_bin, size_in, &root_node1); 75 | if (!root_node1) 76 | { 77 | printf("PList BIN parsing failed\n"); 78 | return 3; 79 | } 80 | 81 | printf("PList BIN parsing succeeded\n"); 82 | plist_to_xml(root_node1, &plist_xml, &size_out); 83 | if (!plist_xml) 84 | { 85 | printf("PList XML writing failed\n"); 86 | return 4; 87 | } 88 | 89 | printf("PList XML writing succeeded\n"); 90 | plist_from_xml(plist_xml, size_out, &root_node2); 91 | if (!root_node2) 92 | { 93 | printf("PList XML parsing failed\n"); 94 | return 5; 95 | } 96 | 97 | printf("PList XML parsing succeeded\n"); 98 | plist_to_bin(root_node2, &plist_bin2, &size_out2); 99 | if (!plist_bin2) 100 | { 101 | printf("PList BIN writing failed\n"); 102 | return 8; 103 | } 104 | 105 | printf("PList BIN writing succeeded\n"); 106 | if (plist_bin2) 107 | { 108 | FILE *oplist = NULL; 109 | oplist = fopen(file_out, "wb"); 110 | fwrite(plist_bin2, size_out2, sizeof(char), oplist); 111 | fclose(oplist); 112 | } 113 | 114 | plist_free(root_node1); 115 | plist_free(root_node2); 116 | free(plist_xml); 117 | free(plist_bin); 118 | free(plist_bin2); 119 | free(filestats); 120 | 121 | if ((uint32_t)size_in != size_out2) 122 | { 123 | printf("Size of input and output is different\n"); 124 | printf("Input size : %i\n", size_in); 125 | printf("Output size : %i\n", size_out2); 126 | } 127 | 128 | //success 129 | return 0; 130 | } 131 | 132 | -------------------------------------------------------------------------------- /test/plist_cmp.c: -------------------------------------------------------------------------------- 1 | /* 2 | * backup_test.c 3 | * source libplist regression test 4 | * 5 | * Copyright (c) 2009 Jonathan Beck All Rights Reserved. 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | 23 | #include "plist/plist.h" 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include 31 | 32 | #ifdef _MSC_VER 33 | #pragma warning(disable:4996) 34 | #endif 35 | 36 | static plist_t plist_get_first_child(plist_t node) 37 | { 38 | return (plist_t) node_first_child((node_t) node); 39 | } 40 | 41 | static plist_t plist_get_next_sibling(plist_t node) 42 | { 43 | return (plist_t) node_next_sibling((node_t) node); 44 | } 45 | 46 | static char compare_plist(plist_t node_l, plist_t node_r) 47 | { 48 | plist_t cur_l = NULL; 49 | plist_t cur_r = NULL; 50 | int res = 1; 51 | 52 | cur_l = plist_get_first_child(node_l); 53 | cur_r = plist_get_first_child(node_r); 54 | 55 | if ( (!cur_l && cur_r) || (cur_l && !cur_r)) 56 | return 0; 57 | 58 | if ( !cur_l && !cur_r ) 59 | return plist_compare_node_value( node_l, node_r ); 60 | 61 | while (cur_l && cur_r && res) 62 | { 63 | 64 | if (!(res = compare_plist(cur_l, cur_r))) 65 | return res; 66 | 67 | cur_l = plist_get_next_sibling(cur_l); 68 | cur_r = plist_get_next_sibling(cur_r); 69 | if ( (!cur_l && cur_r) || (cur_l && !cur_r)) 70 | return 0; 71 | } 72 | 73 | return res; 74 | } 75 | 76 | int main(int argc, char *argv[]) 77 | { 78 | plist_t root_node1 = NULL; 79 | plist_t root_node2 = NULL; 80 | char *file_in1 = NULL; 81 | char *file_in2 = NULL; 82 | int res = 0; 83 | 84 | if (argc!= 3) 85 | { 86 | printf("Wrong input\n"); 87 | return 1; 88 | } 89 | 90 | file_in1 = argv[1]; 91 | file_in2 = argv[2]; 92 | 93 | plist_read_from_file(file_in1, &root_node1, NULL); 94 | plist_read_from_file(file_in2, &root_node2, NULL); 95 | 96 | if (!root_node1 || !root_node2) 97 | { 98 | printf("PList parsing failed\n"); 99 | return 3; 100 | } 101 | 102 | printf("PList parsing succeeded\n"); 103 | res = compare_plist(root_node1, root_node2); 104 | 105 | plist_free(root_node1); 106 | plist_free(root_node2); 107 | 108 | return !res; 109 | } 110 | 111 | -------------------------------------------------------------------------------- /test/plist_jtest.c: -------------------------------------------------------------------------------- 1 | /* 2 | * backup_test.c 3 | * source libplist regression test 4 | * 5 | * Copyright (c) 2009 Jonathan Beck All Rights Reserved. 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | 23 | #include "plist/plist.h" 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #ifdef _MSC_VER 31 | #pragma warning(disable:4996) 32 | #endif 33 | 34 | 35 | int main(int argc, char *argv[]) 36 | { 37 | FILE *iplist = NULL; 38 | plist_t root_node1 = NULL; 39 | plist_t root_node2 = NULL; 40 | char *plist_json = NULL; 41 | char *plist_json2 = NULL; 42 | char *plist_bin = NULL; 43 | int size_in = 0; 44 | uint32_t size_out = 0; 45 | uint32_t size_out2 = 0; 46 | char *file_in = NULL; 47 | char *file_out = NULL; 48 | struct stat *filestats = (struct stat *) malloc(sizeof(struct stat)); 49 | if (argc != 3) 50 | { 51 | printf("Wrong input\n"); 52 | return 1; 53 | } 54 | 55 | file_in = argv[1]; 56 | file_out = argv[2]; 57 | //read input file 58 | iplist = fopen(file_in, "rb"); 59 | 60 | if (!iplist) 61 | { 62 | printf("File does not exists\n"); 63 | return 2; 64 | } 65 | printf("File %s is open\n", file_in); 66 | stat(file_in, filestats); 67 | size_in = filestats->st_size; 68 | plist_json = (char *) malloc(sizeof(char) * (size_in + 1)); 69 | fread(plist_json, sizeof(char), size_in, iplist); 70 | fclose(iplist); 71 | plist_json[size_in] = 0; 72 | 73 | //convert one format to another 74 | plist_from_json(plist_json, size_in, &root_node1); 75 | if (!root_node1) 76 | { 77 | printf("PList JSON parsing failed\n"); 78 | return 3; 79 | } 80 | 81 | printf("PList JSON parsing succeeded\n"); 82 | plist_to_bin(root_node1, &plist_bin, &size_out); 83 | if (!plist_bin) 84 | { 85 | printf("PList BIN writing failed\n"); 86 | return 4; 87 | } 88 | 89 | printf("PList BIN writing succeeded\n"); 90 | plist_from_bin(plist_bin, size_out, &root_node2); 91 | if (!root_node2) 92 | { 93 | printf("PList BIN parsing failed\n"); 94 | return 5; 95 | } 96 | 97 | printf("PList BIN parsing succeeded\n"); 98 | plist_to_json(root_node2, &plist_json2, &size_out2, 0); 99 | if (!plist_json2) 100 | { 101 | printf("PList JSON writing failed\n"); 102 | return 8; 103 | } 104 | 105 | printf("PList JSON writing succeeded\n"); 106 | if (plist_json2) 107 | { 108 | FILE *oplist = NULL; 109 | oplist = fopen(file_out, "wb"); 110 | fwrite(plist_json2, size_out2, sizeof(char), oplist); 111 | fclose(oplist); 112 | } 113 | 114 | plist_free(root_node1); 115 | plist_free(root_node2); 116 | free(plist_bin); 117 | free(plist_json); 118 | free(plist_json2); 119 | free(filestats); 120 | 121 | if ((uint32_t)size_in != size_out2) 122 | { 123 | printf("Size of input and output is different\n"); 124 | printf("Input size : %i\n", size_in); 125 | printf("Output size : %i\n", size_out2); 126 | } 127 | 128 | //success 129 | return 0; 130 | } 131 | 132 | -------------------------------------------------------------------------------- /test/plist_otest.c: -------------------------------------------------------------------------------- 1 | /* 2 | * plist_otest.c 3 | * source libplist regression test 4 | * 5 | * Copyright (c) 2022 Nikias Bassen, All Rights Reserved. 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | 23 | #include "plist/plist.h" 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #ifdef _MSC_VER 31 | #pragma warning(disable:4996) 32 | #endif 33 | 34 | 35 | int main(int argc, char *argv[]) 36 | { 37 | FILE *iplist = NULL; 38 | plist_t root_node1 = NULL; 39 | plist_t root_node2 = NULL; 40 | char *plist_ostep = NULL; 41 | char *plist_ostep2 = NULL; 42 | char *plist_bin = NULL; 43 | int size_in = 0; 44 | uint32_t size_out = 0; 45 | uint32_t size_out2 = 0; 46 | char *file_in = NULL; 47 | char *file_out = NULL; 48 | struct stat filestats; 49 | if (argc != 3) 50 | { 51 | printf("Wrong input\n"); 52 | return 1; 53 | } 54 | 55 | file_in = argv[1]; 56 | file_out = argv[2]; 57 | //read input file 58 | iplist = fopen(file_in, "rb"); 59 | 60 | if (!iplist) 61 | { 62 | printf("File does not exists\n"); 63 | return 2; 64 | } 65 | printf("File %s is open\n", file_in); 66 | stat(file_in, &filestats); 67 | size_in = filestats.st_size; 68 | plist_ostep = (char *) malloc(sizeof(char) * (size_in + 1)); 69 | fread(plist_ostep, sizeof(char), size_in, iplist); 70 | fclose(iplist); 71 | plist_ostep[size_in] = 0; 72 | 73 | //convert one format to another 74 | plist_from_openstep(plist_ostep, size_in, &root_node1); 75 | if (!root_node1) 76 | { 77 | printf("OpenStep PList parsing failed\n"); 78 | return 3; 79 | } 80 | 81 | printf("OpenStep PList parsing succeeded\n"); 82 | plist_to_bin(root_node1, &plist_bin, &size_out); 83 | if (!plist_bin) 84 | { 85 | printf("PList BIN writing failed\n"); 86 | return 4; 87 | } 88 | 89 | printf("PList BIN writing succeeded\n"); 90 | plist_from_bin(plist_bin, size_out, &root_node2); 91 | if (!root_node2) 92 | { 93 | printf("PList BIN parsing failed\n"); 94 | return 5; 95 | } 96 | 97 | printf("PList BIN parsing succeeded\n"); 98 | plist_to_openstep(root_node2, &plist_ostep2, &size_out2, 0); 99 | if (!plist_ostep2) 100 | { 101 | printf("OpenStep PList writing failed\n"); 102 | return 8; 103 | } 104 | 105 | printf("OpenStep PList writing succeeded\n"); 106 | if (plist_ostep2) 107 | { 108 | FILE *oplist = NULL; 109 | oplist = fopen(file_out, "wb"); 110 | fwrite(plist_ostep2, size_out2, sizeof(char), oplist); 111 | fclose(oplist); 112 | } 113 | 114 | plist_free(root_node1); 115 | plist_free(root_node2); 116 | free(plist_bin); 117 | free(plist_ostep); 118 | free(plist_ostep2); 119 | 120 | if ((uint32_t)size_in != size_out2) 121 | { 122 | printf("Size of input and output is different\n"); 123 | printf("Input size : %i\n", size_in); 124 | printf("Output size : %i\n", size_out2); 125 | } 126 | 127 | //success 128 | return 0; 129 | } 130 | 131 | -------------------------------------------------------------------------------- /test/plist_test++.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * source libplist++ regression test 3 | * 4 | * Copyright (c) 2021 Sebastien Gonzalve All Rights Reserved. 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | 22 | #include "plist/plist++.h" 23 | #include 24 | #include 25 | #include 26 | 27 | int main(int argc, char *argv[]) 28 | { 29 | if (argc != 3) 30 | { 31 | printf("Wrong input\n"); 32 | return 1; 33 | } 34 | 35 | const char* file_in = argv[1]; 36 | const char* file_out = argv[2]; 37 | 38 | //read input file 39 | std::ifstream iplist; 40 | iplist.open(file_in); 41 | 42 | if (!iplist) 43 | { 44 | printf("File does not exists\n"); 45 | return 2; 46 | } 47 | 48 | std::cout << "File " << file_in << " is open\n"; 49 | 50 | std::string plist_xml; 51 | { 52 | std::stringstream buffer; 53 | buffer << iplist.rdbuf(); 54 | plist_xml = buffer.str(); 55 | } 56 | 57 | iplist.close(); 58 | 59 | //convert one format to another 60 | PList::Structure* root_node1 = PList::Structure::FromXml(plist_xml); 61 | if (!root_node1) 62 | { 63 | std::cout << "PList XML parsing failed\n"; 64 | return 3; 65 | } 66 | 67 | std::cout << "PList XML parsing succeeded\n"; 68 | std::vector plist_bin = root_node1->ToBin(); 69 | // FIXME There is no way to test for success of ToBin for now. 70 | 71 | std::cout << "PList BIN writing succeeded\n"; 72 | PList::Structure* root_node2 = PList::Structure::FromBin(plist_bin); 73 | if (!root_node2) 74 | { 75 | std::cout << "PList BIN parsing failed\n"; 76 | return 5; 77 | } 78 | 79 | std::cout << "PList BIN parsing succeeded\n"; 80 | std::string plist_xml2 = root_node2->ToXml(); 81 | if (plist_xml2.empty()) 82 | { 83 | std::cout << "PList XML writing failed\n"; 84 | return 8; 85 | } 86 | 87 | std::cout << "PList XML writing succeeded\n"; 88 | { 89 | std::ofstream oplist; 90 | oplist.open(file_out); 91 | oplist << plist_xml2; 92 | } 93 | 94 | if (plist_xml.size() != plist_xml2.size()) 95 | { 96 | std::cout << "Size of input and output is different\n" 97 | << "Input size : " << plist_xml.size() 98 | << "\nOutput size : " << plist_xml2.size() << '\n'; 99 | } 100 | 101 | return 0; 102 | } 103 | 104 | -------------------------------------------------------------------------------- /test/plist_test.c: -------------------------------------------------------------------------------- 1 | /* 2 | * backup_test.c 3 | * source libplist regression test 4 | * 5 | * Copyright (c) 2009 Jonathan Beck All Rights Reserved. 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | 23 | #include "plist/plist.h" 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #ifdef _MSC_VER 31 | #pragma warning(disable:4996) 32 | #endif 33 | 34 | 35 | int main(int argc, char *argv[]) 36 | { 37 | FILE *iplist = NULL; 38 | plist_t root_node1 = NULL; 39 | plist_t root_node2 = NULL; 40 | char *plist_xml = NULL; 41 | char *plist_xml2 = NULL; 42 | char *plist_bin = NULL; 43 | int size_in = 0; 44 | uint32_t size_out = 0; 45 | uint32_t size_out2 = 0; 46 | char *file_in = NULL; 47 | char *file_out = NULL; 48 | struct stat *filestats = (struct stat *) malloc(sizeof(struct stat)); 49 | if (argc != 3) 50 | { 51 | printf("Wrong input\n"); 52 | return 1; 53 | } 54 | 55 | file_in = argv[1]; 56 | file_out = argv[2]; 57 | //read input file 58 | iplist = fopen(file_in, "rb"); 59 | 60 | if (!iplist) 61 | { 62 | printf("File does not exists\n"); 63 | return 2; 64 | } 65 | printf("File %s is open\n", file_in); 66 | stat(file_in, filestats); 67 | size_in = filestats->st_size; 68 | plist_xml = (char *) malloc(sizeof(char) * (size_in + 1)); 69 | fread(plist_xml, sizeof(char), size_in, iplist); 70 | fclose(iplist); 71 | 72 | 73 | //convert one format to another 74 | plist_from_xml(plist_xml, size_in, &root_node1); 75 | if (!root_node1) 76 | { 77 | printf("PList XML parsing failed\n"); 78 | return 3; 79 | } 80 | 81 | printf("PList XML parsing succeeded\n"); 82 | plist_to_bin(root_node1, &plist_bin, &size_out); 83 | if (!plist_bin) 84 | { 85 | printf("PList BIN writing failed\n"); 86 | return 4; 87 | } 88 | 89 | printf("PList BIN writing succeeded\n"); 90 | plist_from_bin(plist_bin, size_out, &root_node2); 91 | if (!root_node2) 92 | { 93 | printf("PList BIN parsing failed\n"); 94 | return 5; 95 | } 96 | 97 | printf("PList BIN parsing succeeded\n"); 98 | plist_to_xml(root_node2, &plist_xml2, &size_out2); 99 | if (!plist_xml2) 100 | { 101 | printf("PList XML writing failed\n"); 102 | return 8; 103 | } 104 | 105 | printf("PList XML writing succeeded\n"); 106 | if (plist_xml2) 107 | { 108 | FILE *oplist = NULL; 109 | oplist = fopen(file_out, "wb"); 110 | fwrite(plist_xml2, size_out2, sizeof(char), oplist); 111 | fclose(oplist); 112 | } 113 | 114 | plist_free(root_node1); 115 | plist_free(root_node2); 116 | free(plist_bin); 117 | free(plist_xml); 118 | free(plist_xml2); 119 | free(filestats); 120 | 121 | if ((uint32_t)size_in != size_out2) 122 | { 123 | printf("Size of input and output is different\n"); 124 | printf("Input size : %i\n", size_in); 125 | printf("Output size : %i\n", size_out2); 126 | } 127 | 128 | //success 129 | return 0; 130 | } 131 | 132 | -------------------------------------------------------------------------------- /test/recursion.test: -------------------------------------------------------------------------------- 1 | ## -*- sh -*- 2 | 3 | DATASRC=$top_srcdir/test/data 4 | TESTFILE=recursion.bplist 5 | DATAIN0=$DATASRC/$TESTFILE 6 | DATAOUT0=$top_builddir/test/data/recursion.test.out 7 | 8 | $top_builddir/tools/plistutil -i $DATAIN0 -o $DATAOUT0 9 | 10 | # test succeeds if plistutil fails 11 | if [ $? -eq 0 ]; then 12 | exit 1 13 | else 14 | exit 0 15 | fi 16 | -------------------------------------------------------------------------------- /test/refsize.test: -------------------------------------------------------------------------------- 1 | ## -*- sh -*- 2 | 3 | set -e 4 | 5 | DATASRC=$top_srcdir/test/data 6 | TESTFILES="dictref1byte.bplist dictref2bytes.bplist dictref3bytes.bplist dictref4bytes.bplist dictref5bytes.bplist dictref6bytes.bplist dictref7bytes.bplist dictref8bytes.bplist" 7 | CMPFILE=offxml.plist 8 | 9 | for I in $TESTFILES; do 10 | echo "* checking $I" 11 | $top_builddir/test/plist_cmp $DATASRC/$I $DATASRC/$CMPFILE 12 | done 13 | -------------------------------------------------------------------------------- /test/signedunsigned1.test: -------------------------------------------------------------------------------- 1 | ## -*- sh -*- 2 | 3 | set -e 4 | 5 | DATASRC=$top_srcdir/test/data 6 | TESTFILE0=signed.plist 7 | TESTFILE1=unsigned.plist 8 | DATAIN0=$DATASRC/$TESTFILE0 9 | DATAIN1=$DATASRC/$TESTFILE1 10 | 11 | CMPFILE0=signed.bplist 12 | CMPFILE1=unsigned.bplist 13 | DATACMP0=$DATASRC/$CMPFILE0 14 | DATACMP1=$DATASRC/$CMPFILE1 15 | 16 | DATAOUT0=$top_builddir/test/data/signedunsigned1.test.signed.bin 17 | DATAOUT1=$top_builddir/test/data/signedunsigned1.test.unsigned.bin 18 | 19 | $top_builddir/tools/plistutil -i $DATAIN0 -o $DATAOUT0 20 | $top_builddir/tools/plistutil -i $DATAIN1 -o $DATAOUT1 21 | 22 | diff --strip-trailing-cr $DATACMP0 $DATAOUT0 23 | diff --strip-trailing-cr $DATACMP1 $DATAOUT1 24 | -------------------------------------------------------------------------------- /test/signedunsigned2.test: -------------------------------------------------------------------------------- 1 | ## -*- sh -*- 2 | 3 | set -e 4 | 5 | DATASRC=$top_srcdir/test/data 6 | TESTFILE0=signed.bplist 7 | TESTFILE1=unsigned.bplist 8 | DATAIN0=$DATASRC/$TESTFILE0 9 | DATAIN1=$DATASRC/$TESTFILE1 10 | 11 | CMPFILE0=signed.plist 12 | CMPFILE1=unsigned.plist 13 | DATACMP0=$DATASRC/$CMPFILE0 14 | DATACMP1=$DATASRC/$CMPFILE1 15 | 16 | DATAOUT0=$top_builddir/test/data/signedunsigned2.test.signed.bin 17 | DATAOUT1=$top_builddir/test/data/signedunsigned2.test.unsigned.bin 18 | 19 | $top_builddir/tools/plistutil -i $DATAIN0 -o $DATAOUT0 20 | $top_builddir/tools/plistutil -i $DATAIN1 -o $DATAOUT1 21 | 22 | diff --strip-trailing-cr $DATACMP0 $DATAOUT0 23 | diff --strip-trailing-cr $DATACMP1 $DATAOUT1 24 | -------------------------------------------------------------------------------- /test/signedunsigned3.test: -------------------------------------------------------------------------------- 1 | ## -*- sh -*- 2 | 3 | set -e 4 | 5 | DATASRC=$top_srcdir/test/data 6 | TESTFILE0=signedunsigned.plist 7 | TESTFILE1=signedunsigned.bplist 8 | DATAIN0=$DATASRC/$TESTFILE0 9 | DATAIN1=$DATASRC/$TESTFILE1 10 | 11 | CMPFILE0=signedunsigned.bplist 12 | CMPFILE1=signedunsigned.plist 13 | DATACMP0=$DATASRC/$CMPFILE0 14 | DATACMP1=$DATASRC/$CMPFILE1 15 | 16 | DATAOUT0=$top_builddir/test/data/signedunsigned3.test.signed.bin 17 | DATAOUT1=$top_builddir/test/data/signedunsigned3.test.unsigned.xml 18 | 19 | $top_builddir/tools/plistutil -i $DATAIN0 -o $DATAOUT0 20 | $top_builddir/tools/plistutil -i $DATAIN1 -o $DATAOUT1 21 | 22 | diff --strip-trailing-cr $DATACMP0 $DATAOUT0 23 | diff --strip-trailing-cr $DATACMP1 $DATAOUT1 24 | -------------------------------------------------------------------------------- /test/small++.test: -------------------------------------------------------------------------------- 1 | ## -*- sh -*- 2 | 3 | DATASRC=$top_srcdir/test/data 4 | DATAOUT=$top_builddir/test/data 5 | TESTFILE=2.plist 6 | 7 | if ! test -d "$DATAOUT"; then 8 | mkdir -p $DATAOUT 9 | fi 10 | 11 | echo "Converting" 12 | $top_builddir/test/plist_test++ $DATASRC/$TESTFILE $DATAOUT/small++.test.out 13 | 14 | echo "Comparing" 15 | $top_builddir/test/plist_cmp $DATASRC/$TESTFILE $DATAOUT/small++.test.out 16 | -------------------------------------------------------------------------------- /test/small.test: -------------------------------------------------------------------------------- 1 | ## -*- sh -*- 2 | 3 | DATASRC=$top_srcdir/test/data 4 | DATAOUT=$top_builddir/test/data 5 | TESTFILE=2.plist 6 | 7 | if ! test -d "$DATAOUT"; then 8 | mkdir -p $DATAOUT 9 | fi 10 | 11 | echo "Converting" 12 | $top_builddir/test/plist_test $DATASRC/$TESTFILE $DATAOUT/small.test.out 13 | 14 | echo "Comparing" 15 | $top_builddir/test/plist_cmp $DATASRC/$TESTFILE $DATAOUT/small.test.out 16 | -------------------------------------------------------------------------------- /test/timezone1.test: -------------------------------------------------------------------------------- 1 | ## -*- sh -*- 2 | 3 | set -e 4 | 5 | DATASRC=$top_srcdir/test/data 6 | TESTFILE=7.plist 7 | DATAIN0=$DATASRC/$TESTFILE 8 | DATAOUT0=$top_builddir/test/data/timezone1.test.tz0.bin 9 | DATAOUT1=$top_builddir/test/data/timezone1.test.tz1.bin 10 | DATAOUT2=$top_builddir/test/data/timezone1.test.tz2.bin 11 | 12 | TZ=UTC $top_builddir/tools/plistutil -i $DATAIN0 -o $DATAOUT0 13 | TZ=Asia/Singapore $top_builddir/tools/plistutil -i $DATAIN0 -o $DATAOUT1 14 | TZ=US/Pacific $top_builddir/tools/plistutil -i $DATAIN0 -o $DATAOUT2 15 | 16 | $top_builddir/test/plist_cmp $DATAOUT0 $DATAOUT1 17 | $top_builddir/test/plist_cmp $DATAOUT0 $DATAOUT2 18 | -------------------------------------------------------------------------------- /test/timezone2.test: -------------------------------------------------------------------------------- 1 | ## -*- sh -*- 2 | 3 | set -e 4 | 5 | DATASRC=$top_srcdir/test/data 6 | TESTFILE=7.plist 7 | DATAIN0=$DATASRC/$TESTFILE 8 | DATAOUT0=$top_builddir/test/data/timezone2.test.bin 9 | DATAOUT1=$top_builddir/test/data/timezone2.test.tz0.xml 10 | DATAOUT2=$top_builddir/test/data/timezone2.test.tz1.xml 11 | DATAOUT3=$top_builddir/test/data/timezone2.test.tz2.xml 12 | 13 | TZ=UTC $top_builddir/tools/plistutil -i $DATAIN0 -o $DATAOUT0 14 | 15 | TZ=UTC $top_builddir/tools/plistutil -i $DATAOUT0 -o $DATAOUT1 16 | TZ=Asia/Singapore $top_builddir/tools/plistutil -i $DATAOUT0 -o $DATAOUT2 17 | TZ=US/Pacific $top_builddir/tools/plistutil -i $DATAOUT0 -o $DATAOUT3 18 | 19 | $top_builddir/test/plist_cmp $DATAIN0 $DATAOUT1 20 | $top_builddir/test/plist_cmp $DATAIN0 $DATAOUT2 21 | $top_builddir/test/plist_cmp $DATAIN0 $DATAOUT3 22 | -------------------------------------------------------------------------------- /test/uid.test: -------------------------------------------------------------------------------- 1 | ## -*- sh -*- 2 | 3 | DATASRC=$top_srcdir/test/data 4 | DATAOUT=$top_builddir/test/data 5 | TESTFILE=uid.bplist 6 | 7 | if ! test -d "$DATAOUT"; then 8 | mkdir -p $DATAOUT 9 | fi 10 | 11 | echo "Converting" 12 | $top_builddir/test/plist_btest $DATASRC/$TESTFILE $DATAOUT/uid.test.out 13 | 14 | echo "Comparing" 15 | $top_builddir/test/plist_cmp $DATASRC/$TESTFILE $DATAOUT/uid.test.out 16 | -------------------------------------------------------------------------------- /tools/Makefile.am: -------------------------------------------------------------------------------- 1 | if BUILD_TOOLS 2 | 3 | AM_CFLAGS = \ 4 | $(GLOBAL_CFLAGS) \ 5 | -I$(top_srcdir)/include 6 | 7 | AM_LDFLAGS = 8 | 9 | bin_PROGRAMS = plistutil 10 | 11 | plistutil_SOURCES = plistutil.c 12 | plistutil_LDADD = $(top_builddir)/src/libplist-2.0.la 13 | 14 | endif 15 | --------------------------------------------------------------------------------