Open Bug 1072317 Opened 5 years ago Updated 2 years ago
numerous instances of warning C4334 '<<' : result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)
This warning appears to be unhelpful; the warnings seem to be triggered by code like: (1 << mPaletteDepth) * sizeof(uint32_t); // imgFrame.h or: cost[1 << i] = ... // opus_encoder.c, cost is a float or: bin->reg_size = (1U << (TINY_MIN_2POW + i)); // jemalloc.c In all these cases, relying on the implicit upcast to a wider type is intended and desirable. I think we should disable the warning.
Why not make those casts explicit instead. I've seen sec bugs in the past due to bit shifting mistakes.
(In reply to Justin Wood (:Callek) from comment #1) > Why not make those casts explicit instead. I've seen sec bugs in the past > due to bit shifting mistakes. Are they sec bugs because of upcasts to a wider type, or were they sec bugs because of off-by-one errors or something else?
iirc it was off-by-one errors, specifically conversions that were intended to either have a dropped leftmost bit due to the shift. Or even things that don't realize they are being converted and are stored in memory allocated for 32 bits, etc. etc. No concrete bugs to point at though.
You need to log in before you can comment on or make changes to this bug.