diff 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
line wrap: on
line diff
--- a/libinterp/corefcn/regexp.cc	Wed Jun 29 19:07:19 2022 +0200
+++ b/libinterp/corefcn/regexp.cc	Mon Jul 04 20:36:01 2022 +0200
@@ -912,6 +912,7 @@
 
 ## segfault test
 %!assert (regexp ("abcde", "."), [1,2,3,4,5])
+%!assert <*62704> (regexpi('(', '\(?'), 1)
 ## Infinite loop test
 %!assert (isempty (regexp ("abcde", "")))