diff options
Diffstat (limited to 'libguile/srfi-14.c')
-rw-r--r-- | libguile/srfi-14.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libguile/srfi-14.c b/libguile/srfi-14.c index af7c1d95b..a4d71e8eb 100644 --- a/libguile/srfi-14.c +++ b/libguile/srfi-14.c @@ -1,6 +1,7 @@ /* srfi-14.c --- SRFI-14 procedures for Guile * - * Copyright (C) 2001, 2004, 2006, 2007, 2009, 2011 Free Software Foundation, Inc. + * Copyright (C) 2001, 2004, 2006, 2007, 2009, 2011, + * 2019 Free Software Foundation, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -363,6 +364,12 @@ charsets_equal (scm_t_char_set *a, scm_t_char_set *b) if (a->len != b->len) return 0; + /* Empty charsets may have ranges == NULL. We must avoid passing + NULL to memcmp, even if the length is zero, to avoid undefined + behavior. */ + if (a->len == 0) + return 1; + if (memcmp (a->ranges, b->ranges, sizeof (scm_t_char_range) * a->len) != 0) return 0; |