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



commit bd63970a192fd9be57184935b55bfac9a718da33
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]