summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorTomeu Vizoso <[email protected]>2019-12-12 14:52:47 +0100
committerTomeu Vizoso <[email protected]>2019-12-12 16:26:58 +0100
commit88f9522f8397532516c0c78624cc9473da483759 (patch)
treee080198ea3695d0abb955c51fc94911750aee285 /src/mesa/state_tracker
parent99d4c71f7eb11293a402e31602e3da5b56fe1581 (diff)
st/mesa: Don't access members of NULL pointers
Should be harmless, but UBSAN complains about it and fills the logs with noise. ../src/mesa/state_tracker/st_manager.c:523:27: runtime error: member access within null pointer of type 'struct st_framebuffer'"} #0 0xaad4e89c in st_framebuffer_reference ../src/mesa/state_tracker/st_manager.c:523"} #1 0xaad4e89c in st_api_make_current ../src/mesa/state_tracker/st_manager.c:1091"} #2 0xaab69e0e in dri_make_current ../src/gallium/state_trackers/dri/dri_context.c:301"} #3 0xaab48fd2 in driBindContext ../src/mesa/drivers/dri/common/dri_util.c:581"} #4 0xb682a122 in dri2_make_current ../src/egl/drivers/dri2/egl_dri2.c:1625"} #5 0xb67f95a4 in eglMakeCurrent ../src/egl/main/eglapi.c:884"} #6 0x4c2b0e in tcu::surfaceless::EglRenderContext::EglRenderContext(glu::RenderConfig const&, tcu::CommandLine const&) (/deqp/modules/gles2/deqp-gles2+0x29b0e)"} #7 0x4c3302 in tcu::surfaceless::ContextFactory::createContext(glu::RenderConfig const&, tcu::CommandLine const&, glu::RenderContext const*) const (/deqp/modules/gles2/deqp-gles2+0x2a302)"} #8 0x73a9b0 in glu::createRenderContext(tcu::Platform&, tcu::CommandLine const&, glu::RenderConfig const&, glu::RenderContext const*) (/deqp/modules/gles2/deqp-gles2+0x2a19b0)"} #9 0x73ad86 in glu::createDefaultRenderContext(tcu::Platform&, tcu::CommandLine const&, glu::ApiType) (/deqp/modules/gles2/deqp-gles2+0x2a1d86)"} #10 0x4c6a78 in deqp::gles2::Context::Context(tcu::TestContext&) (/deqp/modules/gles2/deqp-gles2+0x2da78)"} #11 0x4c3ba0 in deqp::gles2::TestPackage::init() (/deqp/modules/gles2/deqp-gles2+0x2aba0)"} #12 0x852fd8 in tcu::TestHierarchyIterator::next() (/deqp/modules/gles2/deqp-gles2+0x3b9fd8)"} #13 0x829660 in tcu::TestSessionExecutor::iterate() (/deqp/modules/gles2/deqp-gles2+0x390660)"} #14 0x810aac in tcu::App::iterate() (/deqp/modules/gles2/deqp-gles2+0x377aac)"} #15 0x4c1d4c in main (/deqp/modules/gles2/deqp-gles2+0x28d4c)"} #16 0xb64b6aa8 in __libc_start_main (/lib/arm-linux-gnueabihf/libc.so.6+0x1aaa8)"} ../src/mesa/state_tracker/st_atom.c:115:8: runtime error: member access within null pointer of type 'struct st_program'"} #0 0xaae11a58 in check_program_state ../src/mesa/state_tracker/st_atom.c:115"} #1 0xaae128f6 in st_validate_state ../src/mesa/state_tracker/st_atom.c:192"} #2 0xaadc58c2 in prepare_draw ../src/mesa/state_tracker/st_draw.c:132"} #3 0xaadc58c2 in st_draw_vbo ../src/mesa/state_tracker/st_draw.c:184"} #4 0xabc4f924 in _mesa_validated_drawrangeelements ../src/mesa/main/draw.c:816"} #5 0xabc50240 in _mesa_DrawElements ../src/mesa/main/draw.c:970"} #6 0x73ebd2 in glu::CallLogWrapper::glDrawElements(unsigned int, int, unsigned int, void const*) (/deqp/modules/gles2/deqp-gles2+0x2d4bd2)"} #7 0x6d86b2 in deqp::gls::FragOpInteractionCase::iterate() (/deqp/modules/gles2/deqp-gles2+0x26e6b2)"} #8 0x494d16 in deqp::gles2::TestCaseWrapper::iterate(tcu::TestCase*) (/deqp/modules/gles2/deqp-gles2+0x2ad16)"} #9 0x7f9cf2 in tcu::TestSessionExecutor::iterateTestCase(tcu::TestCase*) (/deqp/modules/gles2/deqp-gles2+0x38fcf2)"} #10 0x7fa5f0 in tcu::TestSessionExecutor::iterate() (/deqp/modules/gles2/deqp-gles2+0x3905f0)"} #11 0x7e1aac in tcu::App::iterate() (/deqp/modules/gles2/deqp-gles2+0x377aac)"} #12 0x492d4c in main (/deqp/modules/gles2/deqp-gles2+0x28d4c)"} #13 0xb64b9aa8 in __libc_start_main (/lib/arm-linux-gnueabihf/libc.so.6+0x1aaa8)"} Signed-off-by: Tomeu Vizoso <[email protected]> Reviewed-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_atom.c2
-rw-r--r--src/mesa/state_tracker/st_manager.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c
index 11c8e91ce9f..f6fc615d224 100644
--- a/src/mesa/state_tracker/st_atom.c
+++ b/src/mesa/state_tracker/st_atom.c
@@ -84,7 +84,7 @@ static void check_program_state( struct st_context *st )
/* Flag states used by both new and old shaders to unbind shader resources
* properly when transitioning to shaders that don't use them.
*/
- if (unlikely(new_vp != &old_vp->Base)) {
+ if (unlikely(new_vp != (old_vp ? &old_vp->Base : NULL))) {
if (old_vp)
dirty |= old_vp->affected_states;
if (new_vp)
diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
index d1c5a0b52ad..ce7a2f6f0ed 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -520,7 +520,7 @@ void
st_framebuffer_reference(struct st_framebuffer **ptr,
struct st_framebuffer *stfb)
{
- struct gl_framebuffer *fb = &stfb->Base;
+ struct gl_framebuffer *fb = stfb ? &stfb->Base : NULL;
_mesa_reference_framebuffer((struct gl_framebuffer **) ptr, fb);
}