[libbluray-devel] BDGraphics: Fix reading outside of source image
Ian Curtis
git at videolan.org
Wed Sep 3 12:23:27 CEST 2014
libbluray | branch: master | Ian Curtis <i.curtis at gmail.com> | Wed Sep 3 12:38:05 2014 +0300| [73bc38c391ce50f05c23826280fb5a1943dbb2a1] | committer: hpi1
BDGraphics: Fix reading outside of source image
> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=73bc38c391ce50f05c23826280fb5a1943dbb2a1
---
src/libbluray/bdj/java/java/awt/BDGraphicsBase.java | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/libbluray/bdj/java/java/awt/BDGraphicsBase.java b/src/libbluray/bdj/java/java/awt/BDGraphicsBase.java
index e8ddb7b..deddfe0 100644
--- a/src/libbluray/bdj/java/java/awt/BDGraphicsBase.java
+++ b/src/libbluray/bdj/java/java/awt/BDGraphicsBase.java
@@ -336,6 +336,14 @@ abstract class BDGraphicsBase extends Graphics2D implements ConstrainableGraphic
private void drawSpanN(int x, int y, int length, int src[], int srcOffset, boolean flipX) {
+ /* avoid overreading source */
+ if (srcOffset + length > src.length) {
+ length -= srcOffset + length - src.length;
+ }
+ if (length <= 0) {
+ return;
+ }
+
Rectangle rect = new Rectangle(x, y, length, 1);
rect = actualClip.intersection(rect);
More information about the libbluray-devel
mailing list