Closed Bug 314088 Opened 21 years ago Closed 21 years ago

several Bugzilla::Foo->new crash when passing a string instead of a valid ID as a param

Categories

(Bugzilla :: Bugzilla-General, defect)

2.21
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 2.22

People

(Reporter: LpSolit, Assigned: LpSolit)

Details

Attachments

(1 file)

Group.pm, Classification.pm, Product.pm and Component.pm all crash when a non-numeric ID is passed while creating a new object, due to: my ($param) = (@_); my $id = $param unless (ref $param eq 'HASH'); if (defined $id && detaint_natural($id)) { } elsif (defined $param->{'name'}) { If $id is a string, for instance, detaint_natural($id) is false and then the ELSIF test is executed, and crashes because $param is a string, not a hash. The correct fix is to test detaint_natural($id) in the IF block, and return a nice error if $id is not a valid number.
Status: NEW → ASSIGNED
Summary: several Bugzilla::Foo->new crashes when passing a string instead of a valid ID as a param → several Bugzilla::Foo->new crash when passing a string instead of a valid ID as a param
Attached patch patch, v1 — — Splinter Review
Attachment #201049 - Flags: review?(kiko)
Comment on attachment 201049 [details] [diff] [review] patch, v1 I'm okay if you've verified that the else branches make sense in the light of the slightly altered semantics that are implemented in this patch.
Attachment #201049 - Flags: review?(kiko) → review+
Flags: approval?
Flags: approval? → approval+
Checking in Bugzilla/Classification.pm; /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Classification.pm,v <-- Classification.pm new revision: 1.9; previous revision: 1.8 done Checking in Bugzilla/Component.pm; /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Component.pm,v <-- Component.pm new revision: 1.9; previous revision: 1.8 done Checking in Bugzilla/Group.pm; /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Group.pm,v <-- Group.pm new revision: 1.10; previous revision: 1.9 done Checking in Bugzilla/Product.pm; /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Product.pm,v <-- Product.pm new revision: 1.15; previous revision: 1.14 done Checking in template/en/default/global/code-error.html.tmpl; /cvsroot/mozilla/webtools/bugzilla/template/en/default/global/code-error.html.tmpl,v <-- code-error.html.tmpl new revision: 1.61; previous revision: 1.60 done
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
FWIW, I think you added a duplicate CodeError for this patch; I seem to recall that we already had an applicable CodeError for that message.
(In reply to comment #4) > FWIW, I think you added a duplicate CodeError for this patch; I seem to recall > that we already had an applicable CodeError for that message. I looked at them all in both user-error.html.tmpl and code-error.html.tmpl and couldn't find the one I wanted. ;)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: