[glib: 2/3] guri: Add an assertion to help static analysis




commit 0caa00b34986ae44a083cc71df9612f0cd2156ac
Author: Philip Withnall <withnall endlessm com>
Date:   Tue Aug 18 09:33:42 2020 +0100

    guri: Add an assertion to help static analysis
    
    This might eliminate some false positives being thrown by Coverity to
    do with the return value of `uri_decoder()` and whether it’s allocated
    anything.
    
    Signed-off-by: Philip Withnall <withnall endlessm com>

 glib/guri.c | 1 +
 1 file changed, 1 insertion(+)
---
diff --git a/glib/guri.c b/glib/guri.c
index bead318e5..5fe29f29d 100644
--- a/glib/guri.c
+++ b/glib/guri.c
@@ -350,6 +350,7 @@ uri_decoder (gchar       **out,
   *d = '\0';
 
   len = d - decoded;
+  g_assert (len >= 0);
 
   if (!(flags & G_URI_FLAGS_ENCODED) &&
       !g_utf8_validate (decoded, len, &invalid))


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