1 This patch fixes security problems described in issue 5533654. Since the original fixes in libxml2 includes multiple amendments and are somewhat larger in scope, we limit the fix to just this particular issue to play it safe. 2 The patch does what Chrome does to fix it. 3 4 Eventually, when we upgrade libxml2 library, the patch will be unnecessary. 5 6 7 --- a/xpath.c 2011-10-31 14:31:20.201049035 -0700 8 +++ b/xpath.c 2011-11-01 13:50:00.751736494 -0700 9 @@ -11736,11 +11736,16 @@ 10 11 if ((ctxt->error != XPATH_EXPRESSION_OK) || (res == -1)) { 12 xmlXPathObjectPtr tmp; 13 - /* pop the result */ 14 - tmp = valuePop(ctxt); 15 - xmlXPathReleaseObject(xpctxt, tmp); 16 - /* then pop off contextObj, which will be freed later */ 17 - valuePop(ctxt); 18 + /* pop the result if any */ 19 + tmp = valuePop(ctxt); 20 + while (tmp != contextObj) { 21 + /* 22 + * Free up the result 23 + * then pop off contextObj, which will be freed later 24 + */ 25 + xmlXPathReleaseObject(xpctxt, tmp); 26 + tmp = valuePop(ctxt); 27 + } 28 goto evaluation_error; 29 } 30 31