[libbluray-devel] Check read() and skip() return values

hpi1 git at videolan.org
Mon Sep 1 14:07:29 CEST 2014


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Wed Aug 27 12:17:06 2014 +0300| [af24293bf7b60f6e7f8d4ac2e628fa1317957302] | committer: hpi1

Check read() and skip() return values

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

 .../bdj/java/com/aacsla/bluray/online/ContentAttribute.java      |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/libbluray/bdj/java/com/aacsla/bluray/online/ContentAttribute.java b/src/libbluray/bdj/java/com/aacsla/bluray/online/ContentAttribute.java
index d7bd947..de13511 100644
--- a/src/libbluray/bdj/java/com/aacsla/bluray/online/ContentAttribute.java
+++ b/src/libbluray/bdj/java/com/aacsla/bluray/online/ContentAttribute.java
@@ -31,9 +31,11 @@ public class ContentAttribute {
         try {
             is = new FileInputStream(
                 System.getProperty("bluray.vfs.root") + File.separator + "AACS/Content000.cer");
-            is.skip(14);
+            if (is.skip(14) != 14)
+                return null;
             byte[] bytes = new byte[6];
-            is.read(bytes, 0, 6);
+            if (is.read(bytes, 0, 6) != 6)
+                return null;
             return bytes;
         } catch (Throwable e) {
             e.printStackTrace();



More information about the libbluray-devel mailing list