Closed Bug 1002852 Opened 11 years ago Closed 8 years ago

Investigate why type error in JS_snprintf call was not caught at compile time

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 553032

People

(Reporter: jruderman, Unassigned)

Details

(Keywords: sec-want)

From sewardj in https://bugzilla.mozilla.org/show_bug.cgi?id=990247#c5 : > This is a format string error. Normally I'd expect this kind of thing > to be picked up at compile time, providing JS_snprintf is marked for > gcc format string checking. This isn't the first time this has > happened with printf-style functions inside js/src: see for example > bug 960603.
Nothing much to know here, I believe. gcc's format string checking works by applying an attribute to the function in question (and maybe to its arguments, to some degree). It also only works if you exactly adhere to the C format specifier rules. It's pretty much impossible that our implementation would actually manage to do that, so I don't think this is something any compiler we use is going to be able to pick up, not unless we contributed a generalized format string support system upstream, or so. The better solution is obviously just to get rid of all this format string nonsense entirely. If it has to exist, and I'm skeptical it does, the C++ish way to do this would be with iostream-style type-safe concatenations and such. Not sure what I think about that (and all that work), myself. We should probably just work at killing these functions off a bit harder.
This is being fixed in bug 553032.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.