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
4550f4e3
Commit
4550f4e3
authored
Nov 15, 2018
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pattern length may overflow `uint16_t`; fixed #4163
The issue is reported by `
https://hackerone.com/dgaletic`
.
parent
c3188cac
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
mrbgems/mruby-string-ext/src/string.c
mrbgems/mruby-string-ext/src/string.c
+6
-3
No files found.
mrbgems/mruby-string-ext/src/string.c
View file @
4550f4e3
...
...
@@ -282,7 +282,7 @@ tr_parse_pattern(mrb_state *mrb, struct tr_pattern *ret, const mrb_value v_patte
mrb_int
pattern_length
=
RSTRING_LEN
(
v_pattern
);
mrb_bool
flag_reverse
=
FALSE
;
struct
tr_pattern
*
pat1
;
int
i
=
0
;
mrb_
int
i
=
0
;
if
(
flag_reverse_enable
&&
pattern_length
>=
2
&&
pattern
[
0
]
==
'^'
)
{
flag_reverse
=
TRUE
;
...
...
@@ -313,8 +313,8 @@ tr_parse_pattern(mrb_state *mrb, struct tr_pattern *ret, const mrb_value v_patte
}
else
{
/* in order pattern. */
int
start_pos
=
i
++
;
int
len
;
mrb_
int
start_pos
=
i
++
;
mrb_
int
len
;
while
(
i
<
pattern_length
)
{
if
((
i
+
2
)
<
pattern_length
&&
pattern
[
i
]
!=
'\\'
&&
pattern
[
i
+
1
]
==
'-'
)
...
...
@@ -323,6 +323,9 @@ tr_parse_pattern(mrb_state *mrb, struct tr_pattern *ret, const mrb_value v_patte
}
len
=
i
-
start_pos
;
if
(
len
>
UINT16_MAX
)
{
mrb_raise
(
mrb
,
E_ARGUMENT_ERROR
,
"tr pattern too long (max 65536)"
);
}
if
(
pat1
==
NULL
&&
ret
)
{
goto
nomem
;
}
...
...
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