[libxml2] wrong error column in structured error when skipping whitespace in xml decl



commit 5d4310af453a2220851b7063ebf165ce8b47494c
Author: Juergen Keil <jrgn keil googlemail com>
Date:   Thu Aug 7 16:28:09 2014 +0800

    wrong error column in structured error when skipping whitespace in xml decl
    
    For https://bugzilla.gnome.org/show_bug.cgi?id=734276
    
    libxml2 reports wrong error column numbers (field int2 in xmlError)
    in structured error handler, after an XML declaration containing
    whitespace.
    
    Example XML:
    
    <?xml  version="1.0"  encoding="UTF-8"     ?><root>&</root>
    <!--
             1         2         3         4         5         6
    123456789012345678901234567890123456789012345678901234567890
    -->
    
    Expected location of the error would be line 1, column 53.
    
    The actual location of the error is line 1, column 44:
    
    $ ./xmlparse colbug1.xml
    colbug1.xml:1:44: xmlParseEntityRef: no name

 parser.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/parser.c b/parser.c
index 46fb1e7..fdb4514 100644
--- a/parser.c
+++ b/parser.c
@@ -2109,6 +2109,8 @@ xmlSkipBlankChars(xmlParserCtxtPtr ctxt) {
        while (IS_BLANK_CH(*cur)) {
            if (*cur == '\n') {
                ctxt->input->line++; ctxt->input->col = 1;
+           } else {
+               ctxt->input->col++;
            }
            cur++;
            res++;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]