Closed
Bug 620254
Opened 15 years ago
Closed 3 years ago
txCoreFunctionCall::evaluate NAMESPACE_URI case falls through into POSITION case
Categories
(Core :: XSLT, defect)
Core
XSLT
Tracking
()
RESOLVED
FIXED
People
(Reporter: timeless, Unassigned)
Details
103 txCoreFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
114 switch (mType) {
115 case COUNT:
122 return aContext->recycler()->getNumberResult(nodes->size(),
123 aResult);
125 case ID:
167 return NS_OK;
168 }
169 case LAST:
171 return aContext->recycler()->getNumberResult(aContext->size(),
172 aResult);
174 case LOCAL_NAME:
175 case NAME:
176 case NAMESPACE_URI:
177 {
194 switch (mType) {
195 case LOCAL_NAME:
204 return NS_OK;
206 case NAMESPACE_URI:
215 return NS_OK;
217 case NAME:
234 return NS_OK;
236 default:
237 {
this break is probably missplaced:
238 break;
239 }
240 }
if the code wants to avoid falling through into the following case, then the break needs to be here.
241 }
If you actually *intend* to fall through, then a comment should be inserted *here* - before the case POSITION line to tell readers (and static analysis tools) that you're intentionally falling through
242 case POSITION:
243 {
244 return aContext->recycler()->getNumberResult(aContext->position(),
245 aResult);
246 }
As you can see by looking at the two switch statements, we can never hit the default, it's only there to silence a warning.3
Comment 2•15 years ago
|
||
Maybe throwing in a NS_NOTREACHED() in default: would be a good idea, in case someone adds a new mType in the future and forgets to update this spot?
Even adding a new mType wouldn't be a problem. Look at the two switches in comment 0
Comment 4•15 years ago
|
||
Opening this up. Is there anything that actually needs fixed here? Seems some cleanup could be done...
Group: core-security
Comment 5•4 years ago
|
||
Hello,
Can you still reproduce this issue or should we close it?
Flags: needinfo?(timeless)
@andrei this is embarrassing. It would have taken you seconds to get to the relevant code and see that it has been fixed.
Could you please practice using your tools some more before you ask poor reporters to do work that you should be able to do?
https://searchfox.org/mozilla-central/source/dom/xslt/xpath/txCoreFunctionCall.cpp#190-193
nsresult txCoreFunctionCall::evaluate(txIEvalContext* aContext,
txAExprResult** aResult) {
...
switch (mType) {
case COUNT: {
...
case ID: {
...
case LAST: {
..
case LOCAL_NAME:
case NAME:
case NAMESPACE_URI: {
...
switch (mType) {
case LOCAL_NAME: {
...
}
case NAMESPACE_URI: {
...
}
case NAME: {
...
return NS_OK;
}
default: {
MOZ_CRASH("Unexpected mType?!");
}
}
MOZ_CRASH("Inner mType switch should have returned!");
}
case POSITION: {
...
}
I don't appear to have the ability to resolve as fixed.
andrei.purice@softvision.com: won't you please figure out how to mark this as fixed?
Flags: needinfo?(timeless) → needinfo?(andrei.purice)
Updated•4 years ago
|
QA Whiteboard: QA-not-actionable
Flags: needinfo?(andrei.purice)
Comment 7•3 years ago
|
||
In the process of migrating remaining bugs to the new severity system, the severity for this bug cannot be automatically determined. Please retriage this bug using the new severity system.
Severity: critical → --
Updated•3 years ago
|
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•