summaryrefslogtreecommitdiffstats
path: root/src/bplist.c
AgeCommit message (Collapse)AuthorFilesLines
2016-11-18bplist: Remove misleading/redundant `else` from BPLIST_DATE case in ↵Gravatar Nikias Bassen1-4/+3
parse_bin_node
2016-11-18Improve plist_dict_set_item performance for large dictionaries with hash tableGravatar Nikias Bassen1-1/+1
2016-11-13bplist: Fix surrogate parsing range to include U+100000 - U+1FFFFFGravatar Nikias Bassen1-2/+2
2016-11-10bplist: Make sure to error out if allocation of `used_indexes` buffer in ↵Gravatar Filippo Bigarella1-0/+6
plist_from_bin() fails If the allocation fails, a lot of bad things can happen so we check the result and return accordingly. We also check that the multiplication used to calculate the buffer size doesn't overflow. Otherwise this could lead to an allocation of a very small buffer compared to what we need, ultimately leading to arbitrary writes later on.
2016-11-10bplist: Prevent out-of-bounds read in plist_from_bin() when parsing offset_tableGravatar Filippo Bigarella1-1/+9
offset_table_index is read from the file, so we have full control over it. This means we can point offset_table essentially anywhere we want, which can lead to an out-of-bounds read when it will be used later on.
2016-11-10bplist: Make sure the index in parse_bin_node_at_index() is actually within ↵Gravatar Filippo Bigarella1-4/+13
the offset table
2016-11-10bplist: Fix possible out-of-bounds reads in parse_bin_node() with proper ↵Gravatar Filippo Bigarella1-0/+21
bounds checking
2016-11-10bplist: Fix possible out-of-bounds read in parse_dict_node() with proper ↵Gravatar Filippo Bigarella1-2/+13
bounds checking
2016-10-22Remove libxml2 dependency in favor of custom XML parsingGravatar Nikias Bassen1-2/+1
2016-09-19Change internal storage of PLIST_DATE values from struct timeval to doubleGravatar Nikias Bassen1-9/+2
This removes the timeval union member from the plist_data_t structure. Since struct timeval is 2x64bit on 64bit platforms this member unnecessarily grew the union size to 16 bytes while a size of 8 bytes is sufficient. Also, on 32bit platforms struct timeval is only 2x32bit of size, limiting the range of possible time values. In addition the binary property list format also stores PLIST_DATE nodes as double.
2016-05-12bplist: Speed up plist_to_bin conversion for large plistsGravatar Nikias Bassen1-4/+7
Using a better hashing algorithm and a larger hash table the conversion is A LOT faster when processing large plists. Thanks to Xiao Deng for reporting this issue and suggesting a fix.
2015-02-05bplist: Refactor binary plist parsing in a recursive wayGravatar Nikias Bassen1-209/+167
2015-01-31bplist: Plug memory leaks caused by unused (and unfreed) bufferGravatar Nikias Bassen1-5/+0
When parsing binary plists with BPLIST_DICT or BPLIST_ARRAY nodes that are referenced multiple times in a particular file, a buffer was allocated that was not used, and also not freed, thus causing memory leaks.
2015-01-31bplist: Fix possible crash in plist_from_bin() caused by access to already ↵Gravatar Nikias Bassen1-3/+5
freed memory Given a specifically ordered binary plist the function plist_from_bin() would free BPLIST_DICT or BPLIST_ARRAY raw node data that is still required for parsing of following nodes. This commit addresses this issues by moving the memory free to the end of the parsing process.
2014-10-09bplist: Fix plist_from_bin() changing value nodes to key nodes in dictionariesGravatar Martin Szulecki1-11/+33
The parsing logic for binary dictionaries wrongly enforced the key type even on nodes that were already parsed as value nodes. This caused the resulting plist_t node tree to have key nodes instead of value nodes within dictionaries for some valid binary plists. This commit should also generally fixes parsing of binary plist files which use an efficient dictionary reference table.
2014-10-03Drop src/common.h and use byte order macros from config.h directlyGravatar Nikias Bassen1-11/+14
2014-10-03Avoid exporting non-public symbolsGravatar Nikias Bassen1-2/+2
2014-09-23bplist: Prevent crash in plist_from_bin() when parsing unusually structured ↵Gravatar Nikias Bassen1-1/+1
binary plist
2014-08-25Fixed memory leaks in new_xml_plist() and parse_real_node().Gravatar Aaron Burghardt1-0/+1
2014-08-06bplist: Silence compiler warning about 'always true' comparison due to type ↵Gravatar Nikias Bassen1-2/+6
mismatch
2014-05-23Handle signed vs. unsigned integer values correctlyGravatar Nikias Bassen1-2/+25
2014-05-18bplist: Fix memory leaking caused by unused nodes in plist_from_bin()Gravatar Nikias Bassen1-0/+9
2014-02-06bplist: prevent segmentation fault in plist_from_bin()Gravatar Nikias Bassen1-0/+3
2013-12-13bplist: make plist_utf8_to_utf16 static since it is only used internallyGravatar Nikias Bassen1-1/+1
2013-10-17UTF-16 surrogate pair fixGravatar shane1-4/+37
Handle UTF-16 surrogate pair conversion to/from UTF-8
2013-05-30bplist: use __FLOAT_WORD_ORDER__ instead of __VFP_FP__ for floating point ↵Gravatar Nikias Bassen1-1/+4
endianness detection
2012-09-16implemented handling of UID keyed encoding typeGravatar Nikias Bassen1-2/+58
2012-02-11bplist: fix invalid memory access in copy_plist_dataGravatar Nikias Bassen1-4/+4
2012-01-12fix compiler warningsGravatar Nikias Bassen1-8/+0
2011-05-28define be16toh, be32toh, be64toh if not availableGravatar Nikias Bassen1-0/+34
2011-05-27Make libplist glib freeGravatar Nikias Bassen1-127/+212
2011-03-16Plugging memory leak in write_unicodeGravatar Christophe Fergeau1-0/+1
2010-07-29Fix unicode binary writing.Gravatar Jonathan Beck1-7/+23
2010-04-18Endianness, alignment and type-punning fixes for binary plist supportGravatar Julien BLACHE1-13/+63
- endianness issues: on big endian machines, writing out only part of an integer was broken (get_needed_bytes(x) < sizeof(x)) -> shift integer before memcpy() on big endian machines - alignment issues: unaligned reads when loading binary plist. Leads to slow runtime performance (kernel trapping and fixing things up), SIGBUS (kernel not helping us out) -> introduce get_unaligned() and have the compiler generate the code needed for the unaligned access (note that there remains unaligned accesses that I haven't been able to track down - I've seen 2 of them with test #2) - type-punning issues: breaking strict aliasing rules can lead to unexpected results as the compiler takes full advantage of the aliasing while optimizing -> introduce the plist_uint_ptr union instead of casting pointers Tested on amd64, alpha and hppa.
2010-03-24Fix armel floating point endianess (LP: #541879)Gravatar Alexander Sack1-6/+26
* on armel system floating poing data can have different endianess than rest of types; hence we fix arm endianess for defined(__VFP_FP__) to be big/native; this also applies for data parsing/writing * date parsing didnt flip the endianess back for little endian systems when reading the values causing test failures; we fix this by ensuring float endianess is applied when parsing
2010-01-21Fix some warningsGravatar Jonathan Beck1-3/+2
2009-10-28Format sources to ANSI style using AStyle (astyle --style=ansi).Gravatar Jonathan Beck1-704/+741
2009-10-28Fix build for MSVC9.Gravatar Jonathan Beck1-1/+1
2009-09-06Fix boolean length in binary parsingGravatar Jonathan Beck1-0/+2
2009-07-08Add a deep copy function and value setters for nodes.Gravatar Jonathan Beck1-12/+11
2009-04-28Merge ascii and unicode handling in PLIST_STRING using UTF-8. Remove unicode ↵Gravatar Jonathan Beck1-19/+41
related declaration in API (breaks API&ABI)
2009-04-27Fix compiler pointer assignment warningsGravatar Martin Szulecki1-3/+3
2009-02-15Do not write 3 byte integer nodes. Use standard 4bytes integer instead.Gravatar Jonathan Beck1-1/+5
2009-02-15Add more regression test and fix Integer and Real type handling.Gravatar Jonathan Beck1-64/+16
2009-02-14Fix more memory leaks.Gravatar Jonathan Beck1-0/+7
2009-02-14Fix some memory leaks.Gravatar Jonathan Beck1-0/+1
2009-02-14Fix binary dict indexes.Gravatar Jonathan Beck1-2/+2
2009-02-09Add support for 3 bytes offsets.Gravatar Jonathan Beck1-2/+12
2009-02-09Make it compile on MSVC 2005.Gravatar Jonathan Beck1-44/+83
2009-01-29Fix indent.Gravatar Jonathan Beck1-6/+6