Check that string-find-X-index args are in NFC?
authorChris Hanson <org/chris-hanson/cph>
Sun, 23 Apr 2017 06:54:55 +0000 (23:54 -0700)
committerChris Hanson <org/chris-hanson/cph>
Sun, 23 Apr 2017 06:54:55 +0000 (23:54 -0700)
src/runtime/ustring.scm

index cb3bb3b21f8334cd81c2f220e2f1df555e7604b0..3e949c58929b8420346d8242a52adcf9ff6b4250 100644 (file)
@@ -1725,6 +1725,8 @@ USA.
          #t))))
 
 (define (string-find-first-index proc string . strings)
+  (guarantee nfc-string? string 'string-find-first-index)
+  (guarantee-list-of nfc-string? strings 'string-find-first-index)
   (receive (n proc) (mapper-values proc string strings)
     (let loop ((i 0))
       (and (fix:< i n)
@@ -1733,6 +1735,8 @@ USA.
               (loop (fix:+ i 1)))))))
 
 (define (string-find-last-index proc string . strings)
+  (guarantee nfc-string? string 'string-find-last-index)
+  (guarantee-list-of nfc-string? strings 'string-find-last-index)
   (receive (n proc) (mapper-values proc string strings)
     (let loop ((i (fix:- n 1)))
       (and (fix:>= i 0)