Skip to content

Commit 8ac5c13

Browse files
committed
iset - Fix missing boundary check
#1166
1 parent 4dacd58 commit 8ac5c13

3 files changed

Lines changed: 12 additions & 0 deletions

File tree

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2025-09-09 Shiro Kawai <shiro@acm.org>
2+
3+
* lib/srfi/217.scm (iset-closed-interval): Fix missing boundary check
4+
https://github.com/shirok/Gauche/issues/1166
5+
16
2025-09-06 Shiro Kawai <shiro@acm.org>
27

38
* libsrc/gauche/collection.scm (group-by-size, group-by-size-to):

lib/srfi/217.scm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,7 @@
651651
[g (x->generator tmap)])
652652
(let loop ()
653653
(match (g)
654+
[(? eof-object?) (%make-iset #f rmap)]
654655
[(s . e)
655656
(cond
656657
[(< e lo) (loop)] ;non overwrapping

tests/srfi.scm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3082,6 +3082,12 @@
30823082
'(0 1 2 5 6 7)
30833083
'(-1 0 1 2 3 4 5 6 7 8))
30843084
)
3085+
3086+
;; https://github.com/shirok/Gauche/issues/1166
3087+
(test* "iset-closed-interval corner case" '(1)
3088+
(iset->list (iset-closed-interval (iset 1) 1 2)))
3089+
(test* "iset-closed-interval corner case" '(2 3 5 6 7)
3090+
(iset->list (iset-closed-interval (iset 1 2 3 5 6 7) 2 10)))
30853091
)
30863092

30873093
;;-----------------------------------------------------------------------

0 commit comments

Comments
 (0)