[PATCH libXaw] NULL pointer dereference in XawAsciiSinkInitialize

Peter Hutterer peter.hutterer at who-t.net
Tue Mar 14 23:50:49 UTC 2017


On Mon, Mar 13, 2017 at 08:01:27PM +0100, Tobias Stoeckmann wrote:
> The function XawAsciiSinkInitialize is prone to a NULL pointer
> dereference if no font is available.
> 
> Even though a specific check for a NULL font exists, it is called
> after GetGC(), which in turn would trigger the NPE in such a case.
> 
> Spotted by calling xmessage on a system with an incomplete x font setup:
> 
> $ xmessage -b text
> Warning: Unable to load any usable ISO8859 font
> Segmentation fault
> $ _
> 
> Signed-off-by: Tobias Stoeckmann <tobias at stoeckmann.org>

thanks!

remote: Updating patchwork state for https://patchwork.freedesktop.org/project/Xorg/list/
remote: I: patch #143812 updated using rev ba7321b6a52726cdb9964b82c5111518dc1f437d.
remote: I: 1 patch(es) updated to state Accepted.
To git+ssh://git.freedesktop.org/git/xorg/lib/libXaw
   a77be15..ba7321b  master -> master

Cheers,
   Peter
> ---
>  src/AsciiSink.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/AsciiSink.c b/src/AsciiSink.c
> index d776895..1cccb1c 100644
> --- a/src/AsciiSink.c
> +++ b/src/AsciiSink.c
> @@ -1704,10 +1704,10 @@ XawAsciiSinkInitialize(Widget request, Widget cnew,
>  {
>      AsciiSinkObject sink = (AsciiSinkObject)cnew;
>  
> -    GetGC(sink);
> -
>      if (!sink->ascii_sink.font) XtError("Aborting: no font found\n");
>  
> +    GetGC(sink);
> +
>      sink->ascii_sink.cursor_position = 0;
>      sink->ascii_sink.laststate = XawisOff;
>      sink->ascii_sink.cursor_x = sink->ascii_sink.cursor_y = 0;
> -- 
> 2.12.0


More information about the xorg-devel mailing list