Closed Bug 2035964 Opened 7 months ago Closed 6 months ago

gfx/gl/GLLibraryEGL.h:377:5: runtime error: call to function eglQueryString through pointer to incorrect function type 'const unsigned char *(*)(void *, int)'

Categories

(Core :: Graphics, defect)

Unspecified
Windows
defect

Tracking

()

RESOLVED FIXED
152 Branch
Tracking Status
firefox-esr115 --- wontfix
firefox-esr140 --- wontfix
firefox150 --- wontfix
firefox151 --- wontfix
firefox152 --- fixed

People

(Reporter: tsmith, Assigned: tsmith)

References

(Blocks 1 open bug, )

Details

(Keywords: csectype-undefined, sec-other, Whiteboard: [adv-main152-])

Attachments

(1 external file)

This is hit by many of the top 100 websites when building with --enable-undefined-sanitizer on Windows.

gfx/gl/GLLibraryEGL.h:377:5: runtime error: call to function eglQueryString through pointer to incorrect function type 'const unsigned char *(*)(void *, int)'
src/gfx/angle/checkout/src/libEGL/libEGL_autogen.cpp:199: note: eglQueryString defined here
    #0 0x7ffb486ba7c5 in mozilla::gl::GLLibraryEGL::fQueryString src/objdir-ff-asan-win/gfx/gl/./../../../gfx/gl/GLLibraryEGL.h:377
    #1 0x7ffb486ba7c5 in mozilla::gl::GLLibraryEGL::InitLibExtensions(void) src/objdir-ff-asan-win/gfx/gl/./../../../gfx/gl/GLLibraryEGL.cpp:995
    #2 0x7ffb486b8dd7 in mozilla::gl::GLLibraryEGL::Init(class nsTSubstring<char> *const) src/objdir-ff-asan-win/gfx/gl/./../../../gfx/gl/GLLibraryEGL.cpp:624
    #3 0x7ffb486aea98 in mozilla::gl::GLLibraryEGL::Get(class nsTSubstring<char> *const) src/objdir-ff-asan-win/gfx/gl/./../../../gfx/gl/GLLibraryEGL.cpp:466
    #4 0x7ffb486b43fd in mozilla::gl::DefaultEglDisplay src/objdir-ff-asan-win/gfx/gl/./../../../gfx/gl/GLContextEGL.h:24
    #5 0x7ffb486b43fd in mozilla::gl::GLContextProviderEGL::CreateHeadless(struct mozilla::gl::GLContextCreateDesc const &, class nsTSubstring<char> *const) src/objdir-ff-asan-win/gfx/gl/./../../../gfx/gl/GLContextProviderEGL.cpp:1227
    #6 0x7ffb4bf0b75d in mozilla::WebGLContext::CreateAndInitGL::<lambda_0>::operator() src/objdir-ff-asan-win/dom/canvas/./../../../dom/canvas/WebGLContext.cpp:392
    #7 0x7ffb4bf0b75d in mozilla::WebGLContext::CreateAndInitGL::<lambda_10>::operator() src/objdir-ff-asan-win/dom/canvas/./../../../dom/canvas/WebGLContext.cpp:410
    #8 0x7ffb4bf0b75d in mozilla::WebGLContext::CreateAndInitGL(bool, class std::vector<struct mozilla::WebGLContext::FailureReason, class std::allocator<struct mozilla::WebGLContext::FailureReason>> *const) src/objdir-ff-asan-win/dom/canvas/./../../../dom/canvas/WebGLContext.cpp:399
    #9 0x7ffb4bf0c886 in mozilla::WebGLContext::Create::<lambda_12>::operator() src/objdir-ff-asan-win/dom/canvas/./../../../dom/canvas/WebGLContext.cpp:558
    #10 0x7ffb4bf0c886 in mozilla::WebGLContext::Create(class mozilla::HostWebGLContext *, struct mozilla::webgl::InitContextDesc const &, struct mozilla::webgl::InitContextResult *) src/objdir-ff-asan-win/dom/canvas/./../../../dom/canvas/WebGLContext.cpp:532
    #11 0x7ffb4be19c0e in mozilla::HostWebGLContext::Create(struct mozilla::HostWebGLContext::OwnerData const &, struct mozilla::webgl::InitContextDesc const &, struct mozilla::webgl::InitContextResult *) src/objdir-ff-asan-win/dom/canvas/./../../../dom/canvas/HostWebGLContext.cpp:56
    #12 0x7ffb4bf7ac81 in mozilla::dom::WebGLParent::RecvInitialize(struct mozilla::webgl::InitContextDesc const &, struct mozilla::webgl::InitContextResult *) src/objdir-ff-asan-win/dom/canvas/./../../../dom/canvas/WebGLParent.cpp:18
    #13 0x7ffb4c2f0034 in mozilla::dom::PWebGLParent::OnMessageReceived(class IPC::Message const &, class std::unique_ptr<class IPC::Message, struct std::default_delete<class IPC::Message>> &) src/objdir-ff-asan-win/dom/canvas/./../../ipc/ipdl/PWebGLParent.cpp:532
    #14 0x7ffb49339bfd in mozilla::gfx::PCanvasManagerParent::OnMessageReceived(class IPC::Message const &, class std::unique_ptr<class IPC::Message, struct std::default_delete<class IPC::Message>> &) src/objdir-ff-asan-win/gfx/ipc/./../../ipc/ipdl/PCanvasManagerParent.cpp:538
    #15 0x7ffb47aa3346 in mozilla::ipc::MessageChannel::DispatchSyncMessage(class mozilla::ipc::ActorLifecycleProxy *, class IPC::Message const &, class std::unique_ptr<class IPC::Message, struct std::default_delete<class IPC::Message>> &) src/objdir-ff-asan-win/ipc/glue/./../../../ipc/glue/MessageChannel.cpp:1771
    #16 0x7ffb47aa21a1 in mozilla::ipc::MessageChannel::DispatchMessage(class mozilla::ipc::ActorLifecycleProxy *, class std::unique_ptr<class IPC::Message, struct std::default_delete<class IPC::Message>>) src/objdir-ff-asan-win/ipc/glue/./../../../ipc/glue/MessageChannel.cpp:1722
    #17 0x7ffb47aa298e in mozilla::ipc::MessageChannel::RunMessage(class mozilla::ipc::ActorLifecycleProxy *, class mozilla::ipc::MessageChannel::MessageTask &) src/objdir-ff-asan-win/ipc/glue/./../../../ipc/glue/MessageChannel.cpp:1513
    #18 0x7ffb47aa2e11 in mozilla::ipc::MessageChannel::MessageTask::Run(void) src/objdir-ff-asan-win/ipc/glue/./../../../ipc/glue/MessageChannel.cpp:1615
    #19 0x7ffb4677e414 in nsThread::ProcessNextEvent(bool, bool *) src/objdir-ff-asan-win/xpcom/threads/./../../../xpcom/threads/nsThread.cpp:1173
    #20 0x7ffb46786d48 in NS_ProcessNextEvent(class nsIThread *, bool) src/objdir-ff-asan-win/xpcom/threads/./../../../xpcom/threads/nsThreadUtils.cpp:465
    #21 0x7ffb47aabe73 in mozilla::ipc::MessagePumpForNonMainThreads::Run(class base::MessagePump::Delegate *) src/objdir-ff-asan-win/ipc/glue/./../../../ipc/glue/MessagePump.cpp:327
    #22 0x7ffb479d70a6 in MessageLoop::RunInternal src/objdir-ff-asan-win/ipc/chromium/./../../../ipc/chromium/src/base/message_loop.cc:371
    #23 0x7ffb479d70a6 in MessageLoop::RunHandler(void) src/objdir-ff-asan-win/ipc/chromium/./../../../ipc/chromium/src/base/message_loop.cc:364
    #24 0x7ffb479d6ee4 in MessageLoop::Run(void) src/objdir-ff-asan-win/ipc/chromium/./../../../ipc/chromium/src/base/message_loop.cc:346
    #25 0x7ffb46777bea in nsThread::ThreadFunc(void *) src/objdir-ff-asan-win/xpcom/threads/./../../../xpcom/threads/nsThread.cpp:374
    #26 0x7ffb62a23174 in _PR_NativeRunThread src/objdir-ff-asan-win/config/external/nspr/pr/./../../../../../nsprpub/pr/src/threads/combined/pruthr.c:381
    #27 0x7ffb62a00d2c in pr_root src/objdir-ff-asan-win/config/external/nspr/pr/./../../../../../nsprpub/pr/src/md/windows/w95thred.c:129
    #28 0x7ffbbf3637af  (C:\WINDOWS\System32\ucrtbase.dll+0x1800037af)
    #29 0x7ffb62e0e68d in asan_thread_start /builds/worker/fetches/llvm-project/compiler-rt/lib/asan/asan_win.cpp:147
    #30 0x7ffbc060e8d6  (C:\WINDOWS\System32\KERNEL32.DLL+0x18002e8d6)
    #31 0x7ffb9f8fb78c in mozilla::interceptor::FuncHook<mozilla::interceptor::WindowsDllInterceptor<mozilla::interceptor::VMSharingPolicyShared>,void (*)(int, void *, void *)>::operator() src/toolkit/xre/dllservices/mozglue/nsWindowsDllInterceptor.h:142
    #32 0x7ffb9f8fb78c in patched_BaseThreadInitThunk src/toolkit/xre/dllservices/mozglue/WindowsDllBlocklist.cpp:564
    #33 0x7ffbc1a8c3fb  (C:\WINDOWS\SYSTEM32\ntdll.dll+0x18008c3fb)

SUMMARY: UndefinedBehaviorSanitizer: function-type-mismatch ../../../gfx/gl/GLLibraryEGL.h:377:5
Blocks: site-scout
Attached file (secure) —

Per the EGL spec, eglQueryString returns const char*, not const GLubyte*
(that signature belongs to glGetString). The mismatched typedef in
GLLibraryEGL trips -fsanitize=function on the WebGL init path and would
fault under stricter indirect-call CFI. Correct the typedef and drop the
now-redundant (const char*) casts at call sites.

Assignee: nobody → twsmith
Status: NEW → ASSIGNED
Keywords: sec-other
Group: gfx-core-security → core-security-release
Status: ASSIGNED → RESOLVED
Closed: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → 152 Branch
QA Whiteboard: [sec] [qa-triage-done-c153/b152]
Whiteboard: [adv-main-152-]
Whiteboard: [adv-main-152-] → [adv-main152-]
Group: core-security-release
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: