Commit d8862309 authored by Nick Wellnhofer's avatar Nick Wellnhofer
Browse files

Fix double free in libexslt hash functions

Thanks to Nicolas Gregoire for the report.

Fixes bug #765271:

https://bugzilla.gnome.org/show_bug.cgi?id=765271
parent b73abf1b
......@@ -499,11 +499,8 @@ exsltCryptoMd4Function (xmlXPathParserContextPtr ctxt, int nargs) {
unsigned char hex[MD5_DIGEST_LENGTH * 2 + 1];
str_len = exsltCryptoPopString (ctxt, nargs, &str);
if (str_len == 0) {
xmlXPathReturnEmptyString (ctxt);
xmlFree (str);
if (str_len == 0)
return;
}
PLATFORM_HASH (ctxt, PLATFORM_MD4, (const char *) str, str_len,
(char *) hash);
......@@ -532,11 +529,8 @@ exsltCryptoMd5Function (xmlXPathParserContextPtr ctxt, int nargs) {
unsigned char hex[MD5_DIGEST_LENGTH * 2 + 1];
str_len = exsltCryptoPopString (ctxt, nargs, &str);
if (str_len == 0) {
xmlXPathReturnEmptyString (ctxt);
xmlFree (str);
if (str_len == 0)
return;
}
PLATFORM_HASH (ctxt, PLATFORM_MD5, (const char *) str, str_len,
(char *) hash);
......@@ -565,11 +559,8 @@ exsltCryptoSha1Function (xmlXPathParserContextPtr ctxt, int nargs) {
unsigned char hex[SHA1_DIGEST_LENGTH * 2 + 1];
str_len = exsltCryptoPopString (ctxt, nargs, &str);
if (str_len == 0) {
xmlXPathReturnEmptyString (ctxt);
xmlFree (str);
if (str_len == 0)
return;
}
PLATFORM_HASH (ctxt, PLATFORM_SHA1, (const char *) str, str_len,
(char *) hash);
......
......@@ -17,3 +17,5 @@ text = _Hello, World._ md5 = e9db5cf8349b1166e96a742e198a0dd1 sha1 = 179
text = _Hello, World9_ md5 = faf56df200d7f645a7911c4179614ca8 sha1 = 8a420fad2ccc0504448871245cb5769a42a16cdb
text = _Hello, WorldЖ_ md5 = ffa8f2b84083d767a672debbe535a68e sha1 = 4a57c7b5874d38a98b6de30496fd51894039334f
text = _Hello, WorldZ_ md5 = d6ec5883599d8ad6da7a32a094c1375b sha1 = cdc052e9c8e42b61fd3d45c72211b4d0bafcd39f
text = __ md5 = sha1 =
......@@ -23,4 +23,9 @@
<pattern>Hello, WorldЖ</pattern>
<pattern>Hello, WorldZ</pattern>
<br/>
<!-- Empty string. -->
<pattern/>
</patterns>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment