[meta] Eliminate unsafe buffer usage
Categories
(Core :: General, task)
Tracking
()
People
(Reporter: mccr8, Unassigned)
References
(Blocks 1 open bug)
Details
(Keywords: meta)
The use of raw pointer arithmetic and C-style buffers can lead to security issues because of the lack of bounds checking. Use of this can be treated as a compiler error using -Wunsafe-buffer-usage. One way to address these errors is by replacing the use of raw pointers with bounds checked data structures like mozilla::Span or nsTArray.
Both Chromium and WebKit have made great strides in eliminating this from their code bases. You can see a chart of Chromium's progress here and WebKit says they have gotten more than 90% of their files conforming to this. Here is some documentation on Chromium's efforts, and related things can be found by searching for "spanification".
For now I'll create this meta bug to collect together places where unsafe buffer usage has been removed.
| Reporter | ||
Updated•9 months ago
|
| Reporter | ||
Comment 1•9 months ago
|
||
One way to find places to fix is just look around for these raw buffers. Somewhat ironically, this old meta bug (bug 1229985) about replacing nsAutoArrayPtr with UniquePtr<T[]> might be one place to look. One approach I've been trying is to look at older fixed bugs that have the sec-high and csectype-bounds keywords. That's what led me to bug 1880093, and from there I noticed the use of more C arrays and filed bug 1992422 and bug 1992886.
| Reporter | ||
Comment 2•9 months ago
|
||
Closely related is the compiler option -Wunsafe-buffer-usage-in-libc-call. This isn't exactly the same, but I guess we can use this meta bug for both kinds of issues for now.
Description
•