[Mesa-dev] [PATCH 3/3] hud_context: check NULL return from u_upload_alloc
Marek Olšák
maraeo at gmail.com
Mon Mar 13 16:44:01 UTC 2017
Hi,
I've pushed the series with small commit message changes.
Thanks!
Marek
On Fri, Mar 10, 2017 at 6:16 PM, Julien Isorce <julien.isorce at gmail.com> wrote:
> Fixes the following segmentation fault:
>
> signal SIGSEGV: invalid address (fault address: 0x0)
> frame #0: 0x00007fffe718e117 radeonsi_dri.so hud_draw_background_quad hud_context.c:170
> 167
> 168 assert(hud->bg.num_vertices + 4 <= hud->bg.max_num_vertices);
> 169
> -> 170 vertices[num++] = (float) x1;
> 171 vertices[num++] = (float) y1;
> 172
> 173 vertices[num++] = (float) x1;
> (lldb) bt
> * frame #0: 0x00007fffe718e117 radeonsi_dri.so`hud_draw_background_quad
> frame #1: 0x00007fffe718f458 radeonsi_dri.so`hud_draw
> frame #2: 0x00007fffe712967f radeonsi_dri.so`dri_flush
> ---
> src/gallium/auxiliary/hud/hud_context.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c
> index c44f8c0..29ef9ee 100644
> --- a/src/gallium/auxiliary/hud/hud_context.c
> +++ b/src/gallium/auxiliary/hud/hud_context.c
> @@ -581,6 +581,10 @@ hud_draw(struct hud_context *hud, struct pipe_resource *tex)
> hud->color_prims.buffer_size,
> 16, &hud->bg.vbuf.buffer_offset, &hud->bg.vbuf.buffer,
> (void**)&hud->bg.vertices);
> + if (!hud->bg.vertices) {
> + goto out;
> + }
> +
> pipe_resource_reference(&hud->whitelines.vbuf.buffer, hud->bg.vbuf.buffer);
> pipe_resource_reference(&hud->text.vbuf.buffer, hud->bg.vbuf.buffer);
> pipe_resource_reference(&hud->color_prims.vbuf.buffer, hud->bg.vbuf.buffer);
> @@ -690,6 +694,7 @@ hud_draw(struct hud_context *hud, struct pipe_resource *tex)
> hud_pane_draw_colored_objects(hud, pane);
> }
>
> +out:
> cso_restore_state(cso);
> cso_restore_constant_buffer_slot0(cso, PIPE_SHADER_VERTEX);
>
> --
> 2.7.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list