[libbluray-devel] BDGraphics: fix reading before source image

hpi1 git at videolan.org
Mon Sep 8 23:18:00 CEST 2014


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Mon Sep  8 23:00:47 2014 +0300| [3c0bf5c2d9862ec94e93a9402f58e8efde6c7471] | committer: hpi1

BDGraphics: fix reading before source image

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

 src/libbluray/bdj/java/java/awt/BDGraphicsBase.java |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/libbluray/bdj/java/java/awt/BDGraphicsBase.java b/src/libbluray/bdj/java/java/awt/BDGraphicsBase.java
index deddfe0..5b74385 100644
--- a/src/libbluray/bdj/java/java/awt/BDGraphicsBase.java
+++ b/src/libbluray/bdj/java/java/awt/BDGraphicsBase.java
@@ -340,6 +340,12 @@ abstract class BDGraphicsBase extends Graphics2D implements ConstrainableGraphic
         if (srcOffset + length > src.length) {
             length -= srcOffset + length - src.length;
         }
+        /* avoid underreading source */
+        if (srcOffset < 0) {
+            length += srcOffset;
+            x -= srcOffset;
+            srcOffset = 0;
+        }
         if (length <= 0) {
             return;
         }



More information about the libbluray-devel mailing list