Skip to content

@vector-segment and string-segment enter infinite loop (needs argument check) #828

@jpellegrini

Description

@jpellegrini

Hello,
The 'n' passed to @vector-segment from SRFI-160 and string-segment from SRFI-152 needs to be strictly greater than zero, otherwise Gauche enters an infinite loop:

(use srfi-152)
(use srfi-160)
(string-segment "abcdefg" 0)  ;; <- loop
(u8vector-segment #u8(1 2 3 4 5 6 7 8 9 10 100 200 222) 0)  ;; <- loop

The SRFIs don't mention this specific case, but I suppose this case should trigger an error.

I'd provide a patch, but I'm not familiar with Gauche's source (I actually couldn't find where those procedures are implemented).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions