From: Stef Walter Date: Wed, 1 Aug 2012 09:15:07 +0000 (+0200) Subject: asn1x: Fix assertion in loading of default integer X-Git-Tag: upstream/3.7.5~87 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7f18d97354042cc6f95ebba0a4a4089ab891e066;p=platform%2Fupstream%2Fgcr.git asn1x: Fix assertion in loading of default integer --- diff --git a/egg/egg-asn1x.c b/egg/egg-asn1x.c index 1717127..5168e3f 100644 --- a/egg/egg-asn1x.c +++ b/egg/egg-asn1x.c @@ -2167,6 +2167,7 @@ anode_write_integer_ulong (gulong value, gint bytes, i, off; guchar *at; gboolean sign; + gsize len; for (i = 0; i < sizeof (gulong); ++i) { off = sizeof (gulong) - (i + 1); @@ -2184,9 +2185,10 @@ anode_write_integer_ulong (gulong value, /* If the first byte would make this negative, then add a zero */ at = buf + (sizeof (gulong) - bytes); sign = !!(at[0] & 0x80); + len = bytes + (sign ? 1 : 0); if (data) { - g_assert (*n_data >= bytes + 1); + g_assert (*n_data >= len); if (sign) { data[0] = 0; data++; @@ -2194,7 +2196,7 @@ anode_write_integer_ulong (gulong value, memcpy (data, at, bytes); } - *n_data = bytes + (sign ? 1 : 0); + *n_data = len; } static GBytes *