Closed Bug 1746957 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, P3)

defect

Tracking

()

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

People

(Reporter: tsmith, Unassigned)

References

(Blocks 4 open bugs)

Details

(Keywords: csectype-undefined, testcase)

Attachments

(1 file)

Attached file testcase.html (deleted) —

Found while fuzzing m-c 20211217-ba22a155be2e (--enable-address-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 0x7f824332d566 in int spanNeedsScale<glsl::vec2>(int, glsl::vec2) src/gfx/wr/swgl/src/swgl_ext.h:537:16
    #1 0x7f824332d566 in LinearFilter needsTextureLinear<glsl::sampler2D_impl*, glsl::vec2>(glsl::sampler2D_impl*, glsl::vec2, int) src/gfx/wr/swgl/src/swgl_ext.h:550:19
    #2 0x7f824332d566 in int blendTextureLinearRepeat<true, glsl::sampler2D_impl*, NoColor, unsigned int>(glsl::sampler2D_impl*, glsl::vec2, int, glsl::vec2_scalar const&, glsl::vec4_scalar const&, glsl::vec4_scalar const&, NoColor, unsigned int*) src/gfx/wr/swgl/src/swgl_ext.h:701:7
    #3 0x7f82434a7bd7 in brush_image_ALPHA_PASS_ANTIALIASING_REPETITION_TEXTURE_2D_frag::swgl_drawSpanRGBA8() src/objdir-ff-ubsan/x86_64-unknown-linux-gnu/release/build/swgl-81e23a6b5b5d5a82/out/brush_image_ALPHA_PASS_ANTIALIASING_REPETITION_TEXTURE_2D.h:963:2
    #4 0x7f824349bd83 in brush_image_ALPHA_PASS_ANTIALIASING_REPETITION_TEXTURE_2D_frag::draw_span_RGBA8(brush_image_ALPHA_PASS_ANTIALIASING_REPETITION_TEXTURE_2D_frag*) src/objdir-ff-ubsan/x86_64-unknown-linux-gnu/release/build/swgl-81e23a6b5b5d5a82/out/brush_image_ALPHA_PASS_ANTIALIASING_REPETITION_TEXTURE_2D.h:1006:42
    #5 0x7f82437fa186 in glsl::FragmentShaderImpl::draw_span(unsigned int*, int) src/gfx/wr/swgl/src/program.h:168:12
    #6 0x7f82437fa186 in void draw_depth_span<unsigned int>(unsigned int, unsigned int*, DepthCursor&) src/gfx/wr/swgl/src/rasterize.h:627:38
    #7 0x7f82437fa186 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:1019:13
    #8 0x7f82432c929d in draw_quad(int, Texture&, Texture&) src/gfx/wr/swgl/src/rasterize.h:1615:5
    #9 0x7f82432c45ca in void draw_elements<unsigned short>(int, int, unsigned long, VertexArray&, Texture&, Texture&) src/gfx/wr/swgl/src/rasterize.h:1645:5
    #10 0x7f82432c41a6 in DrawElementsInstanced src/gfx/wr/swgl/src/gl.cc:2738:7
    #11 0x7f8242115f01 in webrender::device::gl::Device::draw_indexed_triangles_instanced_u16::h037961f88c92ec4f src/gfx/wr/webrender/src/device/gl.rs:3639:9
    #12 0x7f82425ad560 in webrender::renderer::Renderer::draw_instanced_batch::h1adce3b75edd9c4a src/gfx/wr/webrender/src/renderer/mod.rs:2498:17
    #13 0x7f82420bb680 in webrender::renderer::Renderer::draw_alpha_batch_container::ha869cb4deeb18150 src/gfx/wr/webrender/src/renderer/mod.rs:2988:17
    #14 0x7f82420c5a29 in webrender::renderer::Renderer::draw_picture_cache_target::h3ce95858f8e72ff5 src/gfx/wr/webrender/src/renderer/mod.rs:2808:9
    #15 0x7f82420c5a29 in webrender::renderer::Renderer::draw_frame::ha0dabf5c0503f358 src/gfx/wr/webrender/src/renderer/mod.rs:4701:21
    #16 0x7f82420a992a in webrender::renderer::Renderer::render_impl::hc522075a3854dfce src/gfx/wr/webrender/src/renderer/mod.rs:2002:17
    #17 0x7f82420a6787 in webrender::renderer::Renderer::render::h4e11dd3761dd7f7a src/gfx/wr/webrender/src/renderer/mod.rs:1724:30
    #18 0x7f8241e6f62d in wr_renderer_render src/gfx/webrender_bindings/src/bindings.rs:622:11
    #19 0x7f8233dbec41 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
    #20 0x7f8233dbd147 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
    #21 0x7f8233dbc225 in mozilla::wr::RenderThread::HandleFrameOneDoc(mozilla::wr::WrWindowId, bool) src/gfx/webrender_bindings/RenderThread.cpp:368:3
    #22 0x7f8233dde13b 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
    #23 0x7f8233dddefb 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
    #24 0x7f8233dddefb 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
    #25 0x7f823097cc37 in nsThread::ProcessNextEvent(bool, bool*) src/xpcom/threads/nsThread.cpp:1177:16
    #26 0x7f82309861d6 in NS_ProcessNextEvent(nsIThread*, bool) src/xpcom/threads/nsThreadUtils.cpp:467:10
    #27 0x7f8231f27744 in mozilla::ipc::MessagePumpForNonMainThreads::Run(base::MessagePump::Delegate*) src/ipc/glue/MessagePump.cpp:330:5
    #28 0x7f8231d85235 in MessageLoop::RunInternal() src/ipc/chromium/src/base/message_loop.cc:331:10
    #29 0x7f8231d85235 in MessageLoop::RunHandler() src/ipc/chromium/src/base/message_loop.cc:324:3
    #30 0x7f8231d85235 in MessageLoop::Run() src/ipc/chromium/src/base/message_loop.cc:306:3
    #31 0x7f8230975c09 in nsThread::ThreadFunc(void*) src/xpcom/threads/nsThread.cpp:391:10
    #32 0x7f825b28a499 in _pt_root src/nsprpub/pr/src/pthreads/ptthread.c:201:5
    #33 0x7f825aec36da in start_thread /build/glibc-S9d2JN/glibc-2.27/nptl/pthread_create.c:463
    #34 0x7f8259ea171e in __clone /build/glibc-S9d2JN/glibc-2.27/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Flags: in-testsuite?

The severity field is not set for this bug.
:jimm, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(jmathies)
Severity: -- → S4
Flags: needinfo?(jmathies) → needinfo?(lsalzman)
Priority: -- → P3

This might be resolved or at least impacted by bug 1746545.

Flags: needinfo?(lsalzman)

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: