File libxml2-CVE-2017-9050.patch of Package libxml2.4904

From beca86e8c86984b967a6efa05a9653470253edda Mon Sep 17 00:00:00 2001
From: Hugh Davenport <hugh@davenport.net.nz>
Date: Wed, 4 May 2016 11:23:49 +0800
Subject: Detect change of encoding when parsing HTML names

From https://bugzilla.gnome.org/show_bug.cgi?id=758518

Happens when a file has a name getting parsed, but no valid encoding
set, so libxml has to guess what the encoding is. This patch detects
when the buffer location changes, and if it does, restarts the parsing
of the name.

This slightly change a couple of regression tests output
---
 HTMLparser.c                | 8 ++++++++
 result/HTML/758605.html     | 2 +-
 result/HTML/758605.html.err | 2 +-
 result/HTML/758605.html.sax | 3 ++-
 4 files changed, 12 insertions(+), 3 deletions(-)

Index: libxml2-2.9.4/HTMLparser.c
===================================================================
--- libxml2-2.9.4.orig/HTMLparser.c
+++ libxml2-2.9.4/HTMLparser.c
@@ -2455,6 +2455,7 @@ htmlParseName(htmlParserCtxtPtr ctxt) {
     const xmlChar *in;
     const xmlChar *ret;
     int count = 0;
+    const xmlChar *base = ctxt->input->base;
 
     GROW;
 
openSUSE Build Service is sponsored by