Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
eb323eb6
Commit
eb323eb6
authored
Mar 09, 2016
by
Frédéric Buclin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 1234977: Replace \d+ by [0-9]+ in critical validation places
r=dylan a=dkl
parent
458aca66
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
21 deletions
+22
-21
Bug.pm
Bugzilla/Bug.pm
+7
-7
Mysql.pm
Bugzilla/DB/Schema/Mysql.pm
+1
-1
Template.pm
Bugzilla/Template.pm
+8
-8
Util.pm
Bugzilla/Util.pm
+2
-2
process_bug.cgi
process_bug.cgi
+4
-3
No files found.
Bugzilla/Bug.pm
View file @
eb323eb6
...
...
@@ -305,15 +305,15 @@ sub new {
my
$param
=
shift
;
# Remove leading "#" mark if we've just been passed an id.
if
(
!
ref
$param
&&
$param
=~
/^#(
\d
+)$/
)
{
if
(
!
ref
$param
&&
$param
=~
/^#(
[0-9]
+)$/
)
{
$param
=
$1
;
}
# If we get something that looks like a word (not a number),
# make it the "name" param.
if
(
!
defined
$param
||
(
!
ref
(
$param
)
&&
$param
!~
/^
\d
+$/
)
||
(
ref
(
$param
)
&&
$param
->
{
id
}
!~
/^
\d
+$/
))
||
(
!
ref
(
$param
)
&&
$param
!~
/^
[0-9]
+$/
)
||
(
ref
(
$param
)
&&
$param
->
{
id
}
!~
/^
[0-9]
+$/
))
{
if
(
$param
)
{
my
$alias
=
ref
(
$param
)
?
$param
->
{
id
}
:
$param
;
...
...
@@ -556,15 +556,15 @@ sub _extract_bug_ids {
my
$s
=
$comment
->
already_wrapped
?
qr/\s/
:
qr/\h/
;
my
$text
=
$comment
->
body
;
# Full bug links
push
@bug_ids
,
$text
=~
/\b$urlbase_re\Qshow_bug.cgi?id=\E(
\d+)(?:\#c\d
+)?/g
;
push
@bug_ids
,
$text
=~
/\b$urlbase_re\Qshow_bug.cgi?id=\E(
[0-9]+)(?:\#c[0-9]
+)?/g
;
# bug X
my
$bug_re
=
qr/\Q$bug_word\E$s*\#?$s*(
\d
+)/
i
;
my
$bug_re
=
qr/\Q$bug_word\E$s*\#?$s*(
[0-9]
+)/
i
;
push
@bug_ids
,
$text
=~
/\b$bug_re/g
;
# bugs X, Y, Z
my
$bugs_re
=
qr/\Q$bugs_word\E$s*\#?$s*(
\d+)(?:$s*,$s*\#?$s*(\d
+))+/
i
;
my
$bugs_re
=
qr/\Q$bugs_word\E$s*\#?$s*(
[0-9]+)(?:$s*,$s*\#?$s*([0-9]
+))+/
i
;
push
@bug_ids
,
$text
=~
/\b$bugs_re/g
;
# Old duplicate markers
push
@bug_ids
,
$text
=~
/(?<=^\*\*\*\ This\ bug\ has\ been\ marked\ as\ a\ duplicate\ of\ )(
\d
+)(?=\ \*\*\*\Z)/
;
push
@bug_ids
,
$text
=~
/(?<=^\*\*\*\ This\ bug\ has\ been\ marked\ as\ a\ duplicate\ of\ )(
[0-9]
+)(?=\ \*\*\*\Z)/
;
}
# Make sure to filter invalid bug IDs.
@bug_ids
=
grep
{
$_
<
MAX_INT_32
}
@bug_ids
;
...
...
Bugzilla/DB/Schema/Mysql.pm
View file @
eb323eb6
...
...
@@ -316,7 +316,7 @@ sub column_info_to_column {
$default
=
0
if
$default
=~
/^0\.0+$/
;
# If we're not a number, we're a string and need to be
# quoted.
$default
=
$dbh
->
quote
(
$default
)
if
!
(
$default
=~
/^(-)?(
\d+)(.\d
+)?$/
);
$default
=
$dbh
->
quote
(
$default
)
if
!
(
$default
=~
/^(-)?(
[0-9]+)(\.[0-9]
+)?$/
);
$column
->
{
DEFAULT
}
=
$default
;
}
}
...
...
Bugzilla/Template.pm
View file @
eb323eb6
...
...
@@ -232,7 +232,7 @@ sub quoteUrls {
~<
a
href
=\
"mailto:$2\">$1$2</a>~igx;
# attachment links
$text =~ s~\b(attachment$s*\#?$s*(
\d
+)(?:$s+\[details\])?)
$text =~ s~\b(attachment$s*\#?$s*(
[0-9]
+)(?:$s+\[details\])?)
~($things[$count++] = get_attachment_link($2, $1, $user)) &&
("
\
x
{
FDD2
}
" . ($count-1) . "
\
x
{
FDD3
}
")
~egmxi;
...
...
@@ -245,9 +245,9 @@ sub quoteUrls {
# Also, we can't use $bug_re?$comment_re? because that will match the
# empty string
my $bug_word = template_var('terms')->{bug};
my $bug_re = qr/\Q$bug_word\E$s*\#?$s*(
\d
+)/i;
my $bug_re = qr/\Q$bug_word\E$s*\#?$s*(
[0-9]
+)/i;
my $comment_word = template_var('terms')->{comment};
my $comment_re = qr/(?:\Q$comment_word\E|comment)$s*\#?$s*(
\d
+)/i;
my $comment_re = qr/(?:\Q$comment_word\E|comment)$s*\#?$s*(
[0-9]
+)/i;
$text =~ s~\b($bug_re(?:$s*,?$s*$comment_re)?|$comment_re)
~ # We have several choices. $1 here is the link, and $2-4 are set
# depending on which part matched
...
...
@@ -261,29 +261,29 @@ sub quoteUrls {
my
$bugs_word
=
template_var
(
'terms'
)
->
{
bugs
};
my
$bugs_re
=
qr/\Q$bugs_word\E$s*\#?$s*
\d+(?:$s*,$s*\#?$s*\d
+)+/
ix
;
[0-9]+(?:$s*,$s*\#?$s*[0-9]
+)+/
ix
;
$text
=~
s{($bugs_re)}{
my $match = $1;
$match =~ s/((?:#$s*)?(
\d
+))/get_bug_link($2, $1);/eg;
$match =~ s/((?:#$s*)?(
[0-9]
+))/get_bug_link($2, $1);/eg;
$match;
}eg
;
my
$comments_word
=
template_var
(
'terms'
)
->
{
comments
};
my
$comments_re
=
qr/(?:comments|\Q$comments_word\E)$s*\#?$s*
\d+(?:$s*,$s*\#?$s*\d
+)+/
ix
;
[0-9]+(?:$s*,$s*\#?$s*[0-9]
+)+/
ix
;
$text
=~
s{($comments_re)}{
my $match = $1;
$match =~ s|((?:#$s*)?(
\d
+))|<a href="$current_bugurl#c$2">$1</a>|g;
$match =~ s|((?:#$s*)?(
[0-9]
+))|<a href="$current_bugurl#c$2">$1</a>|g;
$match;
}eg
;
# Old duplicate markers. These don't use $bug_word because they are old
# and were never customizable.
$text
=~
s
~
(?
<=^\*\*\*\
This
\
bug
\
has
\
been
\
marked
\
as
\
a
\
duplicate
\
of
\
)
(
\
d
+
)
(
[
0
-
9
]
+
)
(?
=\
\*\*\*\
Z
)
~
get_bug_link
(
$1
,
$1
,
{
user
=>
$user
})
~
egmx
;
...
...
Bugzilla/Util.pm
View file @
eb323eb6
...
...
@@ -49,13 +49,13 @@ sub trick_taint {
}
sub
detaint_natural
{
my
$match
=
$_
[
0
]
=~
/^(
\d
+)$/
;
my
$match
=
$_
[
0
]
=~
/^(
[0-9]
+)$/
;
$_
[
0
]
=
$match
?
int
(
$1
)
:
undef
;
return
(
defined
(
$_
[
0
]));
}
sub
detaint_signed
{
my
$match
=
$_
[
0
]
=~
/^([-+]?
\d
+)$/
;
my
$match
=
$_
[
0
]
=~
/^([-+]?
[0-9]
+)$/
;
# The "int()" call removes any leading plus sign.
$_
[
0
]
=
$match
?
int
(
$1
)
:
undef
;
return
(
defined
(
$_
[
0
]));
...
...
process_bug.cgi
View file @
eb323eb6
...
...
@@ -305,9 +305,10 @@ if (defined $cgi->param('id')) {
my
%
is_private
;
foreach
my
$field
(
grep
(
/^defined_isprivate/
,
$cgi
->
param
()))
{
$field
=~
/(\d+)$/
;
my
$comment_id
=
$1
;
$is_private
{
$comment_id
}
=
$cgi
->
param
(
"isprivate_$comment_id"
);
if
(
$field
=~
/(\d+)$/
)
{
my
$comment_id
=
$1
;
$is_private
{
$comment_id
}
=
$cgi
->
param
(
"isprivate_$comment_id"
);
}
}
$set_all_fields
{
comment_is_private
}
=
\%
is_private
;
...
...
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