You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-commits@axis.apache.org by ro...@apache.org on 2026/07/24 14:25:23 UTC

(axis-axis2-c-core) branch master updated: guththila: return -1 error sentinel from guththila_next() fallthrough

This is an automated email from the ASF dual-hosted git repository.

robertlazarski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/axis-axis2-c-core.git


The following commit(s) were added to refs/heads/master by this push:
     new f01683ec1 guththila: return -1 error sentinel from guththila_next() fallthrough
f01683ec1 is described below

commit f01683ec10e8fddb87279ec9351b3239021223e6
Author: Robert Lazarski <ro...@gmail.com>
AuthorDate: Fri Jul 24 04:02:35 2026 -1000

    guththila: return -1 error sentinel from guththila_next() fallthrough
    
    The parser's main loop in guththila_next() ended with "return c;", handing
    back the raw current input byte when no valid event was produced (e.g. an
    unrecognised <! declaration such as <!ENTITY...). Callers expect a
    GUTHTHILA_* event constant or the -1 error sentinel, so leaking a raw byte
    let it be used downstream as an event id / array index.
    
    Return -1 from the fallthrough instead. This complements the wrapper-side
    bounds check in guththila_xml_reader_wrapper_next() by fixing the root cause
    at the parser boundary.
    
    Reported by Adithyan P.
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <no...@anthropic.com>
---
 guththila/src/guththila_xml_parser.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/guththila/src/guththila_xml_parser.c b/guththila/src/guththila_xml_parser.c
index ce83c49b7..ead977790 100644
--- a/guththila/src/guththila_xml_parser.c
+++ b/guththila/src/guththila_xml_parser.c
@@ -1241,7 +1241,11 @@ guththila_next(
         }
     }
     while(loop);
-    return c;
+    /* Fallthrough: no valid event was produced (e.g. malformed input such as
+     * an unrecognised <! declaration). c is a raw input byte here, never a
+     * GUTHTHILA_* event constant, so return the -1 error sentinel rather than
+     * leaking the byte to callers that use it as an event id / array index. */
+    return -1;
 }
 
 /* Process the XML declaration */