heap-buffer-overflow in blendGaussianBlur
Originally disclosed on Mozilla
- Fixed in 16 days
- Paid in 22 days
- Disclosed after 16 days
Created attachment 9251887 heap-buffer-overflow-blendGaussianBlur.html
Tested on:
OS: Ubuntu 20.04 Firefox version: $ fuzzfetch --target firefox --os Linux --asan --fuzzing -n firefox
[2021-11-22 14:04:37] > Task ID: Lkjj4P35Rde9LyC3IRKhUQ
[2021-11-22 14:04:37] > Rank: 1637573952
[2021-11-22 14:04:37] > Changeset: ace2f4af2c29de1886e1e627d0fdb583e7573b59
[2021-11-22 14:04:37] > Build ID: 20211122093912
[2021-11-22 14:04:37] > Downloading: https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/Lkjj4P35Rde9LyC3IRKhUQ/artifacts/public/build/target.tar.bz2
Release Firefox 94.0 (64-bit) crashes with an MOZ_CRASH "called Option::unwrap() on a None value". Didn't set affected version since I didn't try with sanitizer build
Reported it as https://crash-stats.mozilla.org/report/index/c1a7a01e-4819-4b17-abe8-9c7ad0211122
Nightly Firefox crash report: https://crash-stats.mozilla.org/report/index/8913e93c-8f06-48c9-b46e-9f21e0211122
Repro-file as an attachment. If the issue doesn't reproduce, try increasing the number of insertions for the HTML chunk. For my laptop, 800 was enough to start crashing reliably, so I set it to 1000 for the repro-file.
47: var count = 1000;
AddressSanitizer trace:
ATTENTION: default value of option mesa_glthread overridden by environment.
=================================================================
==1855133==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7f887c952807 at pc 0x7f8920093b27 bp 0x7f88f7363c40 sp 0x7f88f7363c38
READ of size 16 at 0x7f887c952807 thread T13 (Renderer)
#0 0x7f8920093b26 in load<unsigned int> /builds/worker/checkouts/gecko/gfx/wr/swgl/src/vector_type.h:503:5
#1 0x7f8920093b26 in unaligned_load<unsigned int __attribute__((ext_vector_type(4))), unsigned int> /builds/worker/checkouts/gecko/gfx/wr/swgl/src/vector_type.h:532:10
#2 0x7f8920093b26 in unsigned short vector[(4) * (sizeof (unsigned int))] glsl::gaussianBlurVertical<unsigned int, glsl::sampler2D_impl*>(glsl::sampler2D_impl*, glsl::ivec2_scalar const&, int, int, int, float, float) /builds/worker/checkouts/gecko/gfx/wr/swgl/src/texture.h:1110:24
#3 0x7f892008533b in blendGaussianBlur<false, glsl::sampler2D_impl *, unsigned int> /builds/worker/checkouts/gecko/gfx/wr/swgl/src/swgl_ext.h:958:16
#4 0x7f892008533b in cs_blur_COLOR_TARGET_frag::swgl_drawSpanRGBA8() /builds/worker/workspace/obj-build/x86_64-unknown-linux-gnu/release/build/swgl-7a39aed50e042c2c/out/cs_blur_COLOR_TARGET.h:635:2
#5 0x7f892007fd19 in cs_blur_COLOR_TARGET_frag::draw_span_RGBA8(cs_blur_COLOR_TARGET_frag*) /builds/worker/workspace/obj-build/x86_64-unknown-linux-gnu/release/build/swgl-7a39aed50e042c2c/out/cs_blur_COLOR_TARGET.h:678:42
#6 0x7f892018de16 in draw_span /builds/worker/checkouts/gecko/gfx/wr/swgl/src/program.h:168:12
#7 0x7f892018de16 in void draw_quad_spans<unsigned int>(int, glsl::vec2_scalar*, unsigned int, glsl::vec3*, Texture&, Texture&, ClipRect const&) /builds/worker/checkouts/gecko/gfx/wr/swgl/src/rasterize.h:1028:42
#8 0x7f891fc7c57e in draw_quad(int, Texture&, Texture&) /builds/worker/checkouts/gecko/gfx/wr/swgl/src/rasterize.h:1615:5
#9 0x7f891fc7a09c in void draw_elements<unsigned short>(int, int, unsigned long, VertexArray&, Texture&, Texture&) /builds/worker/checkouts/gecko/gfx/wr/swgl/src/rasterize.h:1648:7
#10 0x7f891fc79cd9 in DrawElementsInstanced /builds/worker/checkouts/gecko/gfx/wr/swgl/src/gl.cc:2734:7
#11 0x7f891f7b69a0 in webrender::device::gl::Device::draw_indexed_triangles_instanced_u16::hf874f8a08646d2b7 /builds/worker/checkouts/gecko/gfx/wr/webrender/src/device/gl.rs:3639:9
#12 0x7f891f7b69a0 in webrender::renderer::Renderer::draw_instanced_batch::ha606111b3f9e79d9 /builds/worker/checkouts/gecko/gfx/wr/webrender/src/renderer/mod.rs:2496:17
...
#34 0x7f892dc52292 in clone /build/glibc-eX1tMB/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95
0x7f887c952807 is located 7 bytes to the right of 16777216-byte region [0x7f887b952800,0x7f887c952800)
allocated by thread T13 (Renderer) here:
#0 0x55e3f8fba683 in realloc /builds/worker/fetches/llvm-project/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cpp:148:3
#1 0x7f891fc800a1 in Texture::allocate(bool, int, int) /builds/worker/checkouts/gecko/gfx/wr/swgl/src/gl.cc:505:32
#2 0x7f891fc65dcf in set_tex_storage(Texture&, unsigned int, int, int, void*, int, int, int) /builds/worker/checkouts/gecko/gfx/wr/swgl/src/gl.cc:1708:10
#3 0x7f891fc6588e in TexStorage2D /builds/worker/checkouts/gecko/gfx/wr/swgl/src/gl.cc:1724:3
#4 0x7f891fc66b69 in TexImage2D /builds/worker/checkouts/gecko/gfx/wr/swgl/src/gl.cc:1812:3
#5 0x7f891fc49a9f in _$LT$swgl..swgl_fns..Context$u20$as$u20$gleam..gl..Gl$GT$::tex_image_2d::h40885d72a076c3fe /builds/worker/checkouts/gecko/gfx/wr/swgl/src/swgl_fns.rs:995:13
#6 0x7f891f578213 in webrender::device::gl::Device::create_texture::h309962d0f1ae9501 /builds/worker/checkouts/gecko/gfx/wr/webrender/src/device/gl.rs:2535:13
#7 0x7f891f78c743 in webrender::renderer::Renderer::update_texture_cache::_$u7b$$u7b$closure$u7d$$u7d$::h37693bd23f49b62b /builds/worker/checkouts/gecko/gfx/wr/webrender/src/renderer/mod.rs:2364:29
#8 0x7f891f78c743 in core::option::Option$LT$T$GT$::unwrap_or_else::h846cfa865feb4642 /builds/worker/fetches/rust/library/core/src/option.rs:776:21
...
#26 0x7f892cf8409e in _pt_root /builds/worker/checkouts/gecko/nsprpub/pr/src/pthreads/ptthread.c:201:5
#27 0x7f892e08a608 in start_thread /build/glibc-eX1tMB/glibc-2.31/nptl/pthread_create.c:477:8
Thread T13 (Renderer) created by T0 (GeckoMain) here:
#0 0x55e3f8fa4a8c in pthread_create /builds/worker/fetches/llvm-project/llvm/projects/compiler-rt/lib/asan/asan_interceptors.cpp:207:3
#1 0x7f892cf74124 in _PR_CreateThread /builds/worker/checkouts/gecko/nsprpub/pr/src/pthreads/ptthread.c:458:14
#2 0x7f892cf653ce in PR_CreateThread /builds/worker/checkouts/gecko/nsprpub/pr/src/pthreads/ptthread.c:533:12
#3 0x7f890f8436d5 in nsThread::Init(nsTSubstring<char> const&) /builds/worker/checkouts/gecko/xpcom/threads/nsThread.cpp:615:18
#4 0x7f890f85091f in nsThreadManager::NewNamedThread(nsTSubstring<char> const&, unsigned int, nsIThread**) /builds/worker/checkouts/gecko/xpcom/threads/nsThreadManager.cpp:581:12
#5 0x7f890f85bae1 in NS_NewNamedThread(nsTSubstring<char> const&, nsIThread**, already_AddRefed<nsIRunnable>, unsigned int) /builds/worker/checkouts/gecko/xpcom/threads/nsThreadUtils.cpp:163:57
#6 0x7f89129416d1 in NS_NewNamedThread<9UL> /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:74:10
#7 0x7f89129416d1 in mozilla::wr::RenderThread::Start() /builds/worker/checkouts/gecko/gfx/webrender_bindings/RenderThread.cpp:92:17
#8 0x7f89126e1b0e in InitLayersIPC /builds/worker/checkouts/gecko/gfx/thebes/gfxPlatform.cpp:1291:7
...
#50 0x55e3f8fef6d9 in main /builds/worker/checkouts/gecko/browser/app/nsBrowserApp.cpp:395:16
#51 0x7f892db570b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16
SUMMARY: AddressSanitizer: heap-buffer-overflow /builds/worker/checkouts/gecko/gfx/wr/swgl/src/vector_type.h:503:5 in load<unsigned int>
...
==1855133==ABORTING
Exiting due to channel error.
Exiting due to channel error.
Exiting due to channel error.
Exiting due to channel error.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is known
A high-severity memory corruption bug in Graphics: WebRender. Mozilla made it public on 8 December 2021 as CVE-2022-22738.
About Memory corruption
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.