• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1From f8c5e7fb75cd741fb576ddb4de8fcd61f9907549 Mon Sep 17 00:00:00 2001
2From: Nick Wellnhofer <wellnhofer@aevum.de>
3Date: Sun, 22 Jan 2023 13:49:19 +0100
4Subject: [PATCH] buf: Fix return value of xmlBufGetInputBase
5
6Don't return (size_t) -1 in error case.
7
8Found with libFuzzer and -fsanitize=implicit-conversion.
9
10Reference:https://github.com/GNOME/libxml2/commit/f8c5e7fb75cd741fb576ddb4de8fcd61f9907549
11Conflict:NA
12---
13 buf.c | 2 +-
14 1 file changed, 1 insertion(+), 1 deletion(-)
15
16diff --git a/buf.c b/buf.c
17index 69370b7..d8992f7 100644
18--- a/buf.c
19+++ b/buf.c
20@@ -1283,7 +1283,7 @@ xmlBufGetInputBase(xmlBufPtr buf, xmlParserInputPtr input) {
21     size_t base;
22
23     if ((input == NULL) || (buf == NULL) || (buf->error))
24-        return(-1);
25+        return(0);
26     CHECK_COMPAT(buf)
27     base = input->base - buf->content;
28     /*
29--
302.27.0
31
32