Sophie

Sophie

distrib > Mageia > 5 > x86_64 > media > core-updates-src > by-pkgid > fde688f3069f2918988ce2c95b33f20b > files > 4

libplist-1.12-1.mga5.src.rpm

From acd226d1f71a78dd23b47a9a5c4ca8cf8068d509 Mon Sep 17 00:00:00 2001
From: Nikias Bassen <nikias@gmx.li>
Date: Wed, 29 Jun 2016 03:48:14 +0200
Subject: [PATCH] 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.
---
 src/plist.c | 2 ++
 1 file changed, 2 insertions(+)

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