Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
3d1e1460
Commit
3d1e1460
authored
Sep 03, 1992
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve check for offset out of range
parent
f2c8beba
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
Modules/regexmodule.c
Modules/regexmodule.c
+8
-4
No files found.
Modules/regexmodule.c
View file @
3d1e1460
...
...
@@ -98,6 +98,10 @@ reg_match(re, args)
err_clear
();
if
(
!
getargs
(
args
,
"(s#i)"
,
&
buffer
,
&
size
,
&
offset
))
return
NULL
;
if
(
offset
<
0
||
offset
>
size
)
{
err_setstr
(
RegexError
,
"match offset out of range"
);
return
NULL
;
}
}
re
->
re_regs_valid
=
0
;
result
=
re_match
(
&
re
->
re_patbuf
,
buffer
,
size
,
offset
,
&
re
->
re_regs
);
...
...
@@ -128,10 +132,10 @@ reg_search(re, args)
err_clear
();
if
(
!
getargs
(
args
,
"(s#i)"
,
&
buffer
,
&
size
,
&
offset
))
return
NULL
;
}
if
(
offset
<
0
||
offset
>
size
)
{
err_setstr
(
RegexError
,
"search offset out of range"
)
;
return
NULL
;
if
(
offset
<
0
||
offset
>
size
)
{
err_setstr
(
RegexError
,
"search offset out of range"
);
return
NULL
;
}
}
/* NB: In Emacs 18.57, the documentation for re_search[_2] and
the implementation don't match: the documentation states that
...
...
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