Fix null pointer arithmetic UB in libregexp (#136)
This is a patch I originally wrote for the Kiesel JS engine: https://codeberg.org/kiesel-js/kiesel/src/branch/main/patches/libregexp.patch
This commit is contained in:
parent
f181b3e54f
commit
3b034b84d9
1 changed files with 2 additions and 1 deletions
|
@ -1199,9 +1199,10 @@ static int find_group_name(REParseState *s, const char *name)
|
||||||
size_t len, name_len;
|
size_t len, name_len;
|
||||||
int capture_index;
|
int capture_index;
|
||||||
|
|
||||||
name_len = strlen(name);
|
|
||||||
p = (char *)s->group_names.buf;
|
p = (char *)s->group_names.buf;
|
||||||
|
if (!p) return -1;
|
||||||
buf_end = (char *)s->group_names.buf + s->group_names.size;
|
buf_end = (char *)s->group_names.buf + s->group_names.size;
|
||||||
|
name_len = strlen(name);
|
||||||
capture_index = 1;
|
capture_index = 1;
|
||||||
while (p < buf_end) {
|
while (p < buf_end) {
|
||||||
len = strlen(p);
|
len = strlen(p);
|
||||||
|
|
Loading…
Reference in a new issue