Closed Bug 536438 Opened 10 years ago Closed 10 years ago

Buggy switch statement in mathml/nsMathMLChar.cpp

Categories

(Core :: MathML, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla1.9.3a2

People

(Reporter: ehren.m, Assigned: ehren.m)

References

Details

Attachments

(2 files)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.3a1pre) Gecko/20091221 Minefield/3.7a1pre
Build Identifier: 

static PRBool GetFontExtensionPref(nsIPrefBranch* aPrefBranch, PRUnichar aChar, nsMathfontPrefExtension aExtension, nsString& aValue) contains a switch statement that is most likely missing break statements for every case:

http://hg.mozilla.org/mozilla-central/file/5803dc30baea/layout/mathml/nsMathMLChar.cpp#l698

This was discovered using a Treehydra analysis (see blocked bug)

Reproducible: Always
I don't really know this code but this seems to make sense.
Blocks: 535646
Attachment #418884 - Flags: review?(fred.wang)
Attachment #418884 - Flags: review?(fred.wang) → review+
    Yes, I think you are entirely right. Without the break keywords, GetFontExtensionPref is just going to assign different values to the extension string and then go out with a PR_FALSE return value (and that's what I've just checked in debugging mode). Apparently, this function allows to specify font families for a given character but I don't think this preference option is very used. That's probably why no bug has been detected until now. By the way, it seems that the dead code in the second part is also wrong, since the keys are not built correctly (the end of alternateKey is appended to key). I'm going to attach a patch that fix this problem.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Attachment #419026 - Flags: review? → review?(karlt)
Attachment #419026 - Flags: review?(karlt) → review+
http://hg.mozilla.org/mozilla-central/rev/b56dd52130ab
http://hg.mozilla.org/mozilla-central/rev/5c82af652408
Assignee: nobody → ehren.m
Status: NEW → RESOLVED
Closed: 10 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.3a2
You need to log in before you can comment on or make changes to this bug.