dvipng
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dvipng] dvipng crash in stringrgb function


From: Ahzo
Subject: [Dvipng] dvipng crash in stringrgb function
Date: Thu, 27 Jun 2019 20:25:27 +0200 (CEST)

Hi,

When dvipng is given an invalid foreground color, it crashes:
$ dvipng -fg
This is dvipng 1.15 Copyright 2002-2015 Jan-Ake Larsson
Segmentation fault (core dumped)

A possible fix is to make sure tmp is not NULL, when trying to access tmp->name:
--- a/color.c
+++ b/color.c
@@ -355,7 +355,7 @@ void stringrgb(const char* color,int *r,int *g,int *b)
         tmp=tmp->next;
       }
     }
-    if (strcmp(color,tmp->name)==0) {
+    if (tmp!=NULL && strcmp(color,tmp->name)==0) {
       /* Found: one-level recursion */
       DEBUG_PRINT(DEBUG_COLOR,("\n    ---RECURSION--- "))
       stringrgb(tmp->color,r,g,b);

Best,
Ahzo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]