[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] ui/gtk: fix NULL pointer dereference
From: |
Akihiko Odaki |
Subject: |
Re: [PATCH] ui/gtk: fix NULL pointer dereference |
Date: |
Mon, 8 Mar 2021 22:57:22 +0900 |
2021年3月8日(月) 22:38 Peter Maydell <peter.maydell@linaro.org>:
>
> The online defect viewer is a bit better for showing why it thought
> something was an issue. In this case we have at the top of the function:
>
> trace_gd_switch(vc->label,
> surface ? surface_width(surface) : 0,
> surface ? surface_height(surface) : 0);
>
> which tests whether surface is NULL, implying that sometimes it is.
>
> Then later we have:
> if (vc->gfx.ds && surface &&
>
> also checking surface for NULL-ness.
>
> Finally we have:
> if (surface->format == PIXMAN_x8r8g8b8) {
>
> which dereferences surface without checking if it's NULL.
>
> So there is definitely a bug here:
> (1) either surface can never be NULL, and all the places where
> the function is testing for NULL-ness are wrong and need to be removed
> (2) or surface can be NULL, and we should check here too
>
> Coverity can't tell us which of the two possibilities is right, of course.
>
> thanks
> -- PMM
c821a58ee7 ("ui/console: Pass placeholder surface to display")
intended to eliminate the possibility that surface is NULL, so (1) is
the case. I am preparing a patch to remove NULL checks.
Thanks,
Akihiko Odaki
- [PATCH] ui/gtk: fix NULL pointer dereference, Christian Schoenebeck, 2021/03/07
- Re: [PATCH] ui/gtk: fix NULL pointer dereference, Akihiko Odaki, 2021/03/07
- Re: [PATCH] ui/gtk: fix NULL pointer dereference, Christian Schoenebeck, 2021/03/08
- Re: [PATCH] ui/gtk: fix NULL pointer dereference, Akihiko Odaki, 2021/03/08
- Re: [PATCH] ui/gtk: fix NULL pointer dereference, Christian Schoenebeck, 2021/03/08
- Re: [PATCH] ui/gtk: fix NULL pointer dereference, Akihiko Odaki, 2021/03/08
- Re: [PATCH] ui/gtk: fix NULL pointer dereference, Peter Maydell, 2021/03/08
- Re: [PATCH] ui/gtk: fix NULL pointer dereference,
Akihiko Odaki <=
- Re: [PATCH] ui/gtk: fix NULL pointer dereference, Christian Schoenebeck, 2021/03/08
- Re: [PATCH] ui/gtk: fix NULL pointer dereference, Akihiko Odaki, 2021/03/08
- Re: [PATCH] ui/gtk: fix NULL pointer dereference, Philippe Mathieu-Daudé, 2021/03/08
- Re: [PATCH] ui/gtk: fix NULL pointer dereference, Christian Schoenebeck, 2021/03/08
- Re: [PATCH] ui/gtk: fix NULL pointer dereference, Akihiko Odaki, 2021/03/08