summaryrefslogtreecommitdiff
path: root/test-suite
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2021-03-15 21:23:43 +0100
committerAndy Wingo <wingo@pobox.com>2021-03-15 21:23:43 +0100
commitd87b57a00bb8f755fdca46d10c9d411d48efa1e9 (patch)
tree81c0c690ae5c4a766839abaa1c50b2e768e47778 /test-suite
parent5a1a1eee5061f6b7deda7d187123561f8f7e5aae (diff)
downloadguile-d87b57a00bb8f755fdca46d10c9d411d48efa1e9.tar.gz
Fix buffer overread in string-locale-ci=? and related functions
* libguile/i18n.c (u32_locale_casecoll): Take lengths of incoming strings as parameters rather than assuming "nul" termination. (compare_u32_strings_ci): Pass string lengths as computed from the Scheme strings. * test-suite/tests/i18n.test ("text collation (English)"): Add a test case. Thanks a million to Rob Browning for the report.
Diffstat (limited to 'test-suite')
-rw-r--r--test-suite/tests/i18n.test10
1 files changed, 7 insertions, 3 deletions
diff --git a/test-suite/tests/i18n.test b/test-suite/tests/i18n.test
index 427aef4f5..f288da06d 100644
--- a/test-suite/tests/i18n.test
+++ b/test-suite/tests/i18n.test
@@ -1,8 +1,7 @@
;;;; i18n.test --- Exercise the i18n API. -*- coding: utf-8; mode: scheme; -*-
;;;;
-;;;; Copyright (C) 2006, 2007, 2009, 2010, 2011, 2012,
-;;;; 2013, 2014, 2015, 2016, 2017, 2018 Free Software Foundation, Inc.
-;;;; Ludovic Courtès
+;;;; Copyright (C) 2006-2007,2009-2019,2021 Free Software Foundation, Inc.
+;;;; Author: Ludovic Courtès
;;;;
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
@@ -75,6 +74,11 @@
(string-locale-ci=? "Hello" "HELLO"
(make-locale (list LC_COLLATE) "C"))))
+ (pass-if "string-locale-ci=?, bis"
+ (let* ((strings (list "⇒a" "⇒b"))
+ (heads (map (lambda (s) (substring/shared s 0 1)) strings)))
+ (apply string-locale-ci=? heads)))
+
(pass-if "string-locale-ci<?"
(and (string-locale-ci<? "hello" "WORLD")
(string-locale-ci<? "hello" "WORLD"