Mercurial > octave
comparison libinterp/corefcn/regexp.cc @ 31114:5cf18ef0377c stable
regexp: Check pattern length before accessing it (bug #62704).
* liboctave/util/lo-regexp.cc (regexp::compile_internal): Check string length
before accessing character at position.
* libinterp/corefcn/regexp.cc (Fregexp): Add test.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Mon, 04 Jul 2022 20:36:01 +0200 |
parents | 796f54d4ddbf |
children | d8d90ba892b0 |
comparison
equal
deleted
inserted
replaced
31112:7060de0b45e5 | 31114:5cf18ef0377c |
---|---|
910 %! warning (ws); | 910 %! warning (ws); |
911 %! end_unwind_protect | 911 %! end_unwind_protect |
912 | 912 |
913 ## segfault test | 913 ## segfault test |
914 %!assert (regexp ("abcde", "."), [1,2,3,4,5]) | 914 %!assert (regexp ("abcde", "."), [1,2,3,4,5]) |
915 %!assert <*62704> (regexpi('(', '\(?'), 1) | |
915 ## Infinite loop test | 916 ## Infinite loop test |
916 %!assert (isempty (regexp ("abcde", ""))) | 917 %!assert (isempty (regexp ("abcde", ""))) |
917 | 918 |
918 ## Check that anchoring of pattern works correctly | 919 ## Check that anchoring of pattern works correctly |
919 %!assert (regexp ('abcabc', '^abc'), 1) | 920 %!assert (regexp ('abcabc', '^abc'), 1) |