Closed Bug 1746939 Opened 3 years ago Closed 3 years ago

src/swgl_ext.h:537:16: runtime error: -nan is outside the range of representable values of type 'int'

Categories

(Core :: Graphics: WebRender, defect)

defect

Tracking

()

RESOLVED DUPLICATE of bug 1746545
Tracking Status
firefox97 --- affected

People

(Reporter: tsmith, Unassigned)

References

(Blocks 3 open bugs)

Details

(Keywords: csectype-undefined, testcase)

Attachments

(1 file)

Attached file testcase.html

Found while fuzzing m-c 20211217-ba22a155be2e (--enable-undefined-sanitizer --enable-fuzzing)

This was found by enabling the float-cast-overflow check in UBSan. This type of issue can create inconsistencies across platforms, architectures and optimization levels.

To enable this check add the following to your mozconfig:

ac_add_options --enable-undefined-sanitizer="float-cast-overflow"

To reproduce with the attached test case use the following commands:

$ pip install grizzly-framework
$ python -m grizzly.replay <ubsan-build>/firefox testcase.html --xvfb
src/swgl_ext.h:537:16: runtime error: -nan is outside the range of representable values of type 'int'
    #0 0x7fe3a38b86ad in brush_image_ALPHA_PASS_TEXTURE_2D_frag::swgl_drawSpanRGBA8() src/objdir-ff-ubsan/x86_64-unknown-linux-gnu/release/build/swgl-81e23a6b5b5d5a82/out/brush_image_ALPHA_PASS_TEXTURE_2D.h
    #1 0x7fe3a38ab533 in brush_image_ALPHA_PASS_TEXTURE_2D_frag::draw_span_RGBA8(brush_image_ALPHA_PASS_TEXTURE_2D_frag*) src/objdir-ff-ubsan/x86_64-unknown-linux-gnu/release/build/swgl-81e23a6b5b5d5a82/out/brush_image_ALPHA_PASS_TEXTURE_2D.h:930:42
    #2 0x7fe3a3bec82c in glsl::FragmentShaderImpl::draw_span(unsigned int*, int) src/gfx/wr/swgl/src/program.h:168:12
    #3 0x7fe3a3bec82c in void draw_quad_spans<unsigned int>(int, glsl::vec2_scalar*, unsigned int, glsl::vec3*, Texture&, Texture&, ClipRect const&) src/gfx/wr/swgl/src/rasterize.h:1028:42
    #4 0x7fe3a36a729d in draw_quad(int, Texture&, Texture&) src/gfx/wr/swgl/src/rasterize.h:1615:5
    #5 0x7fe3a36a2638 in void draw_elements<unsigned short>(int, int, unsigned long, VertexArray&, Texture&, Texture&) src/gfx/wr/swgl/src/rasterize.h:1648:7
    #6 0x7fe3a36a21a6 in DrawElementsInstanced src/gfx/wr/swgl/src/gl.cc:2738:7
    #7 0x7fe3a24f3f01 in webrender::device::gl::Device::draw_indexed_triangles_instanced_u16::h037961f88c92ec4f src/gfx/wr/webrender/src/device/gl.rs:3639:9
    #8 0x7fe3a298b560 in webrender::renderer::Renderer::draw_instanced_batch::h1adce3b75edd9c4a src/gfx/wr/webrender/src/renderer/mod.rs:2498:17
    #9 0x7fe3a2499680 in webrender::renderer::Renderer::draw_alpha_batch_container::ha869cb4deeb18150 src/gfx/wr/webrender/src/renderer/mod.rs:2988:17
    #10 0x7fe3a24a6f22 in webrender::renderer::Renderer::draw_color_target::h8973be2edd1984fd src/gfx/wr/webrender/src/renderer/mod.rs:3689:13
    #11 0x7fe3a24a6f22 in webrender::renderer::Renderer::draw_frame::ha0dabf5c0503f358 src/gfx/wr/webrender/src/renderer/mod.rs:4788:17
    #12 0x7fe3a248792a in webrender::renderer::Renderer::render_impl::hc522075a3854dfce src/gfx/wr/webrender/src/renderer/mod.rs:2002:17
    #13 0x7fe3a2484787 in webrender::renderer::Renderer::render::h4e11dd3761dd7f7a src/gfx/wr/webrender/src/renderer/mod.rs:1724:30
    #14 0x7fe3a224d62d in wr_renderer_render src/gfx/webrender_bindings/src/bindings.rs:622:11
    #15 0x7fe39419cc41 in mozilla::wr::RendererOGL::UpdateAndRender(mozilla::Maybe<mozilla::gfx::IntSizeTyped<mozilla::gfx::UnknownUnits> > const&, mozilla::Maybe<mozilla::wr::ImageFormat> const&, mozilla::Maybe<mozilla::Range<unsigned char> > const&, bool*, mozilla::wr::RendererStats*) src/gfx/webrender_bindings/RendererOGL.cpp:185:8
    #16 0x7fe39419b147 in mozilla::wr::RenderThread::UpdateAndRender(mozilla::wr::WrWindowId, mozilla::layers::BaseTransactionId<mozilla::VsyncIdType> const&, mozilla::TimeStamp const&, bool, mozilla::Maybe<mozilla::gfx::IntSizeTyped<mozilla::gfx::UnknownUnits> > const&, mozilla::Maybe<mozilla::wr::ImageFormat> const&, mozilla::Maybe<mozilla::Range<unsigned char> > const&, bool*) src/gfx/webrender_bindings/RenderThread.cpp:516:31
    #17 0x7fe39419a225 in mozilla::wr::RenderThread::HandleFrameOneDoc(mozilla::wr::WrWindowId, bool) src/gfx/webrender_bindings/RenderThread.cpp:368:3
    #18 0x7fe3941bc13b in decltype(*(fp).*fp0(Get<0ul>(fp1).PassAsParameter(), Get<1ul>(fp1).PassAsParameter())) mozilla::detail::RunnableMethodArguments<mozilla::wr::WrWindowId, bool>::applyImpl<mozilla::wr::RenderThread, void (mozilla::wr::RenderThread::*)(mozilla::wr::WrWindowId, bool), StoreCopyPassByConstLRef<mozilla::wr::WrWindowId>, StoreCopyPassByConstLRef<bool>, 0ul, 1ul>(mozilla::wr::RenderThread*, void (mozilla::wr::RenderThread::*)(mozilla::wr::WrWindowId, bool), mozilla::Tuple<StoreCopyPassByConstLRef<mozilla::wr::WrWindowId>, StoreCopyPassByConstLRef<bool> >&, std::integer_sequence<unsigned long, 0ul, 1ul>) src/objdir-ff-ubsan/dist/include/nsThreadUtils.h:1147:12
    #19 0x7fe3941bbefb in decltype(applyImpl(fp, fp0, *(this).mArguments, std::integer_sequence<unsigned long, 0ul, 1ul>{})) mozilla::detail::RunnableMethodArguments<mozilla::wr::WrWindowId, bool>::apply<mozilla::wr::RenderThread, void (mozilla::wr::RenderThread::*)(mozilla::wr::WrWindowId, bool)>(mozilla::wr::RenderThread*, void (mozilla::wr::RenderThread::*)(mozilla::wr::WrWindowId, bool)) src/objdir-ff-ubsan/dist/include/nsThreadUtils.h:1153:12
    #20 0x7fe3941bbefb in mozilla::detail::RunnableMethodImpl<mozilla::wr::RenderThread*, void (mozilla::wr::RenderThread::*)(mozilla::wr::WrWindowId, bool), true, (mozilla::RunnableKind)0, mozilla::wr::WrWindowId, bool>::Run() src/objdir-ff-ubsan/dist/include/nsThreadUtils.h:1200:13
    #21 0x7fe390d5ac37 in nsThread::ProcessNextEvent(bool, bool*) src/xpcom/threads/nsThread.cpp:1177:16
    #22 0x7fe390d641d6 in NS_ProcessNextEvent(nsIThread*, bool) src/xpcom/threads/nsThreadUtils.cpp:467:10
    #23 0x7fe392305744 in mozilla::ipc::MessagePumpForNonMainThreads::Run(base::MessagePump::Delegate*) src/ipc/glue/MessagePump.cpp:330:5
    #24 0x7fe392163235 in MessageLoop::RunInternal() src/ipc/chromium/src/base/message_loop.cc:331:10
    #25 0x7fe392163235 in MessageLoop::RunHandler() src/ipc/chromium/src/base/message_loop.cc:324:3
    #26 0x7fe392163235 in MessageLoop::Run() src/ipc/chromium/src/base/message_loop.cc:306:3
    #27 0x7fe390d53c09 in nsThread::ThreadFunc(void*) src/xpcom/threads/nsThread.cpp:391:10
    #28 0x7fe3bb66d499 in _pt_root src/nsprpub/pr/src/pthreads/ptthread.c:201:5
    #29 0x7fe3bb2a16da in start_thread /build/glibc-S9d2JN/glibc-2.27/nptl/pthread_create.c:463
    #30 0x7fe3ba27f71e in __clone /build/glibc-S9d2JN/glibc-2.27/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Flags: in-testsuite?
Flags: needinfo?(lsalzman)
Severity: -- → S4
Flags: needinfo?(lsalzman)
See Also: → 1746545

This is no longer reproducible with the attached test case with the patch from bug 1746545 applied.

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: