[PATCH] PLUGINS/src/osddemo/osddemo.c: fix possible null pointer dereference

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

 



Date: Sun, 3 Apr 2011 22:53:33 +0200

Cppcheck reports the following.

        $ cppcheck --version
        Cppcheck 1.47
        $ cppcheck .
        [â]
        Checking ./PLUGINS/src/osddemo/osddemo.c...
        [./PLUGINS/src/osddemo/osddemo.c:8]: (debug) Include file: "vdr/osd.h" not found.
        [./PLUGINS/src/osddemo/osddemo.c:9]: (debug) Include file: "vdr/plugin.h" not found.
        [./PLUGINS/src/osddemo/osddemo.c:270]: (error) Possible null pointer dereference: NextPixmap
        [â]

`CreateTextPixmap` can indeed assign `NULL` to `NextPixmap` and right before in line 265 the same check is performed.

Signed-off-by: Paul Menzel <paulepanter@xxxxxxxxxxxxxxxxxxxxx>
CC: Klaus Schmidinger <Klaus.Schmidinger@xxxxxxx>
---
 PLUGINS/src/osddemo/osddemo.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/PLUGINS/src/osddemo/osddemo.c b/PLUGINS/src/osddemo/osddemo.c
index 2e6a33b..d3ec718 100644
--- a/PLUGINS/src/osddemo/osddemo.c
+++ b/PLUGINS/src/osddemo/osddemo.c
@@ -267,7 +267,9 @@ void cTrueColorDemo::Action(void)
                              }
                           Start = cTimeMs::Now();
                           StartLine = Line;
-                          Line += NextPixmap->DrawPort().Height();
+                          if (NextPixmap) {
+                             Line += NextPixmap->DrawPort().Height();
+                             }
                           }
                        State++;
                      }
-- 
1.7.4.1

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
vdr mailing list
vdr@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr

[Index of Archives]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Big List of Linux Books]     [Fedora Users]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux