Last Comment Bug 710988 - Possible operator precedence error in ots_gdef_parse()
: Possible operator precedence error in ots_gdef_parse()
[pvs-studio][good first bug][lang=c++]
Product: Core
Classification: Components
Component: Graphics (show other bugs)
: unspecified
: All All
-- normal (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
: Milan Sreckovic [:milan]
Depends on:
Blocks: 710966
  Show dependency treegraph
Reported: 2011-12-14 23:38 PST by Justin Dolske [:Dolske]
Modified: 2011-12-20 06:08 PST (History)
3 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Description User image Justin Dolske [:Dolske] 2011-12-14 23:38:21 PST
5th section in

V502 Perhaps the '?:' operator works in a different way than it was expected. The '?:' operator has a lower priority than the '+' operator. 291

bool ots_gdef_parse(...) {
  const unsigned gdef_header_end = static_cast<unsigned>(8) +
    gdef->version_2 ? static_cast<unsigned>(2) : static_cast<unsigned>(0);

I think there could be written like this.
const unsigned gdef_header_end = static_cast<unsigned>(8) +
  (gdef->version_2 ? static_cast<unsigned>(2) : static_cast<unsigned>(0));
Comment 1 User image Jonathan Kew (:jfkthame) 2011-12-20 06:08:22 PST
This bug is no longer present on trunk. The fragment in question has been restructured (upstream in OTS rev.66) and does not have this problem. The fix was imported into Gecko as part of bug 699420.

Note You need to log in before you can comment on or make changes to this bug.