fix `get-output-{bytes,string}' with bad starting index, no ending index
Closes PR 13933
This commit is contained in:
parent
868e6b97b7
commit
e0bab441a8
|
@ -211,6 +211,11 @@
|
|||
(test #"23" get-output-bytes os #t 1 3)
|
||||
(test #"" get-output-bytes os #f 0 #f))
|
||||
|
||||
(err/rt-test (get-output-bytes (open-output-bytes) #t 1))
|
||||
(err/rt-test (get-output-bytes (open-output-bytes) #t 0 1))
|
||||
(err/rt-test (get-output-bytes (open-output-string) #t 1))
|
||||
(err/rt-test (get-output-bytes (open-output-string) #t 0 1))
|
||||
|
||||
(define s (open-output-string))
|
||||
(err/rt-test (file-position 's 1))
|
||||
(err/rt-test (file-position s 'one))
|
||||
|
|
|
@ -2648,7 +2648,7 @@ Scheme_Object *do_get_output_string(const char *who, int is_byte,
|
|||
if (endpos < 0)
|
||||
endpos = len+1;
|
||||
}
|
||||
|
||||
|
||||
if (!(startpos <= len)) {
|
||||
scheme_out_of_range(who, "port", "starting ", argv[2], argv[0], 0, len);
|
||||
return NULL;
|
||||
|
@ -2657,8 +2657,13 @@ Scheme_Object *do_get_output_string(const char *who, int is_byte,
|
|||
scheme_out_of_range(who, "port", "ending ", argv[3], argv[0], startpos, len);
|
||||
return NULL;
|
||||
}
|
||||
} else
|
||||
} else {
|
||||
if (!(startpos <= len)) {
|
||||
scheme_out_of_range(who, "port", "starting ", argv[2], argv[0], 0, len);
|
||||
return NULL;
|
||||
}
|
||||
endpos = -1;
|
||||
}
|
||||
} else {
|
||||
startpos = 0;
|
||||
endpos = -1;
|
||||
|
|
Loading…
Reference in New Issue
Block a user