summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2016-06-29 03:48:14 +0200
committerGravatar Nikias Bassen2016-06-29 03:48:14 +0200
commitacd226d1f71a78dd23b47a9a5c4ca8cf8068d509 (patch)
treea23498299d254b835a857ca7afc908978ffa44ee
parent11d639f92f2c7067a0e7cc949f147abd506514ec (diff)
downloadlibplist-acd226d1f71a78dd23b47a9a5c4ca8cf8068d509.tar.gz
libplist-acd226d1f71a78dd23b47a9a5c4ca8cf8068d509.tar.bz2
plist_data_compare: Make sure to compare the node sizes for integer nodes
Without this check, e.g. the values -1 and 18446744073709551615 would yield in a match, since the comparison will just compare the uint64_t values. However, any value >= 9223372036854775808 and <= 18446744073709551615 is stored as a 128 bit value in binary plist format to make sure it is recognized as an unsigned value. We store it internally as a uint64_t value, but we set the size to 16 vs. 8 accordingly; so this commit will make sure the binary plist optimization will not re-use matching uint64_t values of actually mismatching signed/unsigned values.
-rw-r--r--src/plist.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/plist.c b/src/plist.c
index 1ff17fc..d20a252 100644
--- a/src/plist.c
+++ b/src/plist.c
@@ -701,6 +701,8 @@ int plist_data_compare(const void *a, const void *b)
case PLIST_UINT:
case PLIST_REAL:
case PLIST_UID:
+ if (val_a->length != val_b->length)
+ return FALSE;
if (val_a->intval == val_b->intval) //it is an union so this is sufficient
return TRUE;
else