Avoid raw calls to snprintf
Categories
(Core :: General, defect, P3)
Tracking
()
People
(Reporter: darin.moz, Assigned: tjr)
References
Details
(Keywords: sec-want)
Attachments
(10 files)
(deleted),
patch
|
dougt
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details |
Comment 2•19 years ago
|
||
Reporter | ||
Comment 3•19 years ago
|
||
Comment 4•19 years ago
|
||
Comment 5•19 years ago
|
||
Updated•12 years ago
|
Updated•12 years ago
|
Comment 7•12 years ago
|
||
Comment 10•12 years ago
|
||
Comment 11•12 years ago
|
||
Comment 12•12 years ago
|
||
Comment 13•11 years ago
|
||
Comment 14•11 years ago
|
||
Updated•11 years ago
|
Comment 15•11 years ago
|
||
Comment 17•11 years ago
|
||
Comment 19•11 years ago
|
||
Comment 20•11 years ago
|
||
Comment 21•11 years ago
|
||
Comment 22•11 years ago
|
||
Comment 23•11 years ago
|
||
Comment 24•11 years ago
|
||
Comment 25•11 years ago
|
||
Comment 26•11 years ago
|
||
Updated•11 years ago
|
Comment 27•11 years ago
|
||
Comment 28•11 years ago
|
||
Comment 29•10 years ago
|
||
Comment 30•10 years ago
|
||
Comment 31•10 years ago
|
||
Comment 32•10 years ago
|
||
Comment 33•10 years ago
|
||
Comment 34•10 years ago
|
||
Updated•10 years ago
|
Updated•10 years ago
|
Updated•10 years ago
|
Updated•10 years ago
|
Updated•10 years ago
|
Updated•10 years ago
|
Updated•10 years ago
|
Updated•10 years ago
|
Comment 35•8 years ago
|
||
Comment 36•8 years ago
|
||
Comment 37•8 years ago
|
||
Updated•7 years ago
|
Comment 38•2 years ago
|
||
In the process of migrating remaining bugs to the new severity system, the severity for this bug cannot be automatically determined. Please retriage this bug using the new severity system.
Updated•2 years ago
|
Assignee | ||
Comment 40•2 years ago
|
||
The bad snprintf behavior on Windows was done by _snprintf; and the new (2015) snprintf function does the correct thing. So I think it would be sufficient for this bug not to cut over all the snprintf calls to some other snprintf, but rather fix the fewer snprintf -> _snprintf
defines.
Comment 41•2 years ago
|
||
This seems broad enough that it can stay in Core:General.
Assignee | ||
Comment 42•2 years ago
|
||
Assignee | ||
Comment 43•2 years ago
|
||
The attached patch seems to build and run - I don't think we can land it as is, but I bet we can land individual components of it that will address the majority of instances.
Updated•2 years ago
|
Assignee | ||
Comment 44•2 years ago
|
||
So it turns out that the vast majority of changes are upstream libraries so.... that's difficult. But here's two in our code.
Assignee | ||
Comment 45•2 years ago
|
||
Comment 46•2 years ago
|
||
Do we still build on MSC_VER < 1900 (pre VS2015)? I'm guessing not...
We'll need to leave imported code (and comments, etc) alone, I think.
Unconditional defines to _snprintf could be removed, probably (or if building on MSC_VER<1900 is still viable, adding a #if). Ditto for "#if MSC_VER"
Comment 47•2 years ago
|
||
(In reply to Randell Jesup [:jesup] (needinfo me) from comment #46)
Do we still build on MSC_VER < 1900 (pre VS2015)? I'm guessing not...
We dropped support for pre-VS2005u3. See bug 1319901.
We'll need to leave imported code (and comments, etc) alone, I think.
We can touch dom/media/webrtc/transport/third_party/nrappkit/upstream.diff
. This file is our local patch, not imported code. Here is a precedent:
https://hg.mozilla.org/mozilla-central/rev/ea36b327a1ee18c08613d1fe36cc6b8d18c8e47f
Similarly, we can add a .patch file under gfx/cairo/
and apply the patch to cairo-compiler-private.h
.
Assignee | ||
Comment 48•2 years ago
|
||
Because cairo's snprintf -> _snprintf define is under a _MSC_VER < 1900
conditional we don't need to do anything there.
And dom/media/webrtc/transport/third_party/nrappkit/upstream.diff
is actually already doing the correct thing - it's removing the snprintf -> _snprintf mapping from the upstream code.
gfx/cairo/win32-inline-cpp-keyword.patch
seems like a old dead patch that wouldn't apply
ipc/chromium/src/third_party/libevent/sample/https-client.c
isn't built
third_party/libsrtp/src/test/cutest.h
is a test file
third_party/wasm2c/src/config.cc
and third_party/wasm2c/src/config.h.in
is acknowledging the problem and making a work-around
other-licenses/nsis/Contrib/ExDLL/tchar.h
which I'm not worried about because this is not client code
These are all also fine (behind a _MSC_VER < 1900 conditional)
gfx/angle/checkout/src/common/angleutils.h
gfx/harfbuzz/src/hb.hh
media/libvpx/libvpx/vpx_ports/msvc.h
modules/freetype2/src/gzip/gzguts.h
modules/zlib/src/gzguts.h
nsprpub/pr/src/io/prprf.c
security/nss/lib/zlib/gzguts.h
(so many zlibs!)third_party/aom/aom_ports/msvc.h
third_party/libwebrtc/rtc_base/logging.cc
toolkit/crashreporter/google-breakpad/src/common/stdio_wrapper.h
That leaves the following upstream code:
- gfx/angle/checkout/third_party/vulkan-deps/vulkan-headers/src/include/vulkan/vk_sdk_platform.h
- two things in gfx/skia
toolkit/components/protobuf/src/google/protobuf/stubs/strutil.cc
toolkit/components/protobuf/src/google/protobuf/stubs/common.cc
toolkit/crashreporter/google-breakpad/src/third_party/libdisasm/
things
Updated•2 years ago
|
Assignee | ||
Comment 49•2 years ago
|
||
This patch hasn't been touched in ten years and the code it affects does not
appear in the file, so I think it is old an unused.
Depends on D159430
Comment 50•2 years ago
|
||
Comment 51•2 years ago
|
||
bugherder |
Assignee | ||
Comment 52•2 years ago
|
||
gfx/angle/checkout/third_party/vulkan-deps/vulkan-headers/src/include/vulkan/vk_sdk_platform.h
doesn't seem to be included anywhere, nor does any vulkan file use snprintf.
toolkit/components/protobuf/src/google/protobuf/stubs/strutil.cc
is safe, there's a bunch of extra checks for it. Plus I don't think it's actually accessible by web content.
toolkit/components/protobuf/src/google/protobuf/stubs/common.cc
is similarly safe
For libdisasm, AFAICT libdisasm is only used by the exploitability check, and we disable that check. So we might be able to remove that entire blob of code. I filed Bug 1798516 for that.
This just leaves Skia.
Assignee | ||
Comment 53•2 years ago
|
||
I filed https://bugs.chromium.org/p/skia/issues/detail?id=13879 upstream, but looking closer, skia only seems to use it for two things: path debugging (not relevant) and determining the length of the string to write to a stream (write_scalar) - the latter doesn't need to worry about a null terminator.
So I think we can call this fixed.
Updated•2 years ago
|
Description
•