[evolution-data-server/gnome-3-36] evo-I#915 - Fix some issues reported by Clang's ubsan sanitizer



commit 634579119bb17aa25324b5159b559ba5aa86c921
Author: Milan Crha <mcrha redhat com>
Date:   Tue May 12 18:19:02 2020 +0200

    evo-I#915 - Fix some issues reported by Clang's ubsan sanitizer
    
    Related to https://gitlab.gnome.org/GNOME/evolution/-/issues/915

 src/camel/camel-trie.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/src/camel/camel-trie.c b/src/camel/camel-trie.c
index 74bf233fb..701f03ece 100644
--- a/src/camel/camel-trie.c
+++ b/src/camel/camel-trie.c
@@ -61,13 +61,18 @@ trie_utf8_getc (const guchar **in,
                 gsize inlen)
 {
        register const guchar *inptr = *in;
-       const guchar *inend = inptr + inlen;
+       const guchar *inend;
        register guchar c, r;
        register gunichar u, m;
 
+       if (inlen == -1)
+               inlen = strlen ((const gchar *) inptr);
+
        if (inlen == 0)
                return 0;
 
+       inend = inptr + inlen;
+
        r = *inptr++;
        if (r < 0x80) {
                *in = inptr;


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