Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
15563713
Unverified
Commit
15563713
authored
Jul 12, 2019
by
Yukihiro "Matz" Matsumoto
Committed by
GitHub
Jul 12, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4573 from dearblue/fix-4569
Fix heap buffer overflow; fix #4569
parents
54712c06
bde2f35a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
13 deletions
+11
-13
src/string.c
src/string.c
+11
-13
No files found.
src/string.c
View file @
15563713
...
...
@@ -324,22 +324,20 @@ str_index_str_by_char_search(mrb_state *mrb, const char *p, const char *pend, co
}
/* Searching */
if
(
p
<
pend
&&
pend
-
p
>=
slen
)
{
for
(;;)
{
const
char
*
pivot
;
while
(
p
<
pend
&&
pend
-
p
>=
slen
)
{
const
char
*
pivot
;
if
(
memcmp
(
p
,
s
,
slen
)
==
0
)
{
return
off
;
}
if
(
memcmp
(
p
,
s
,
slen
)
==
0
)
{
return
off
;
}
pivot
=
p
+
qstable
[(
unsigned
char
)
p
[
slen
-
1
]];
if
(
pivot
>
pend
||
pivot
<
p
/* overflowed */
)
{
return
-
1
;
}
pivot
=
p
+
qstable
[(
unsigned
char
)
p
[
slen
-
1
]];
if
(
pivot
>
pend
||
pivot
<
p
/* overflowed */
)
{
return
-
1
;
}
do
{
p
+=
utf8len
(
p
,
pend
);
off
++
;
}
while
(
p
<
pivot
);
}
do
{
p
+=
utf8len
(
p
,
pend
);
off
++
;
}
while
(
p
<
pivot
);
}
return
-
1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment