[libbluray-devel] Fix possible null pointer dereference

hpi1 git at videolan.org
Wed Jun 3 10:37:49 CEST 2015


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Tue Jun  2 14:01:08 2015 +0300| [a827d8f439b63d9278cf254b23bee6c578457940] | committer: hpi1

Fix possible null pointer dereference

Also log error if context does not match

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=a827d8f439b63d9278cf254b23bee6c578457940
---

 .../bdj/java/javax/tv/graphics/TVContainer.java         |   15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/libbluray/bdj/java/javax/tv/graphics/TVContainer.java b/src/libbluray/bdj/java/javax/tv/graphics/TVContainer.java
index e036884..09971b6 100644
--- a/src/libbluray/bdj/java/javax/tv/graphics/TVContainer.java
+++ b/src/libbluray/bdj/java/javax/tv/graphics/TVContainer.java
@@ -20,9 +20,10 @@ package javax.tv.graphics;
 
 import java.awt.Container;
 import javax.tv.xlet.XletContext;
-import org.havi.ui.HScene;
 import org.havi.ui.HSceneFactory;
 
+import org.videolan.BDJXletContext;
+
 public class TVContainer {
     public static Container getRootContainer(XletContext context)
     {
@@ -30,7 +31,15 @@ public class TVContainer {
             throw new NullPointerException();
         }
 
-        HScene scene = HSceneFactory.getInstance().getDefaultHScene();
-        return scene;
+        if (!(context instanceof BDJXletContext) || (BDJXletContext)context != BDJXletContext.getCurrentContext()) {
+            org.videolan.Logger.getLogger(TVContainer.class.getName()).error("wrong context");
+        }
+
+        /* GEM: return instance of org.havi.ui.HScene or NULL */
+        HSceneFactory sf = HSceneFactory.getInstance();
+        if (sf != null) {
+            return sf.getDefaultHScene();
+        }
+        return null;
     }
 }



More information about the libbluray-devel mailing list