[libbluray-devel] RegisterAccess: log invalid register number
hpi1
git at videolan.org
Fri Sep 15 11:45:41 CEST 2017
libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Thu Sep 14 18:28:53 2017 +0300| [c998e6bad9f939611438c401a18e587e1d22fc05] | committer: hpi1
RegisterAccess: log invalid register number
> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=c998e6bad9f939611438c401a18e587e1d22fc05
---
.../bdj/java/org/bluray/system/RegisterAccess.java | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/src/libbluray/bdj/java/org/bluray/system/RegisterAccess.java b/src/libbluray/bdj/java/org/bluray/system/RegisterAccess.java
index fd659ba1..3737f51d 100644
--- a/src/libbluray/bdj/java/org/bluray/system/RegisterAccess.java
+++ b/src/libbluray/bdj/java/org/bluray/system/RegisterAccess.java
@@ -19,6 +19,7 @@
package org.bluray.system;
import org.videolan.Libbluray;
+import org.videolan.Logger;
public class RegisterAccess {
private RegisterAccess() {
@@ -29,14 +30,28 @@ public class RegisterAccess {
}
public int getGPR(int num) {
+ if (num < 0 || num > 4095) {
+ logger.error("getGPR(" + num + "): invalid GPR");
+ throw new IllegalArgumentException("GPR " + num + " is not supported.");
+ }
+
return Libbluray.readGPR(num);
}
public int getPSR(int num) {
+ if (num < 0 || num > 127) {
+ logger.error("getPSR(" + num + "): invalid PSR");
+ throw new IllegalArgumentException("PSR " + num + " is not supported.");
+ }
+
return Libbluray.readPSR(num);
}
public void setGPR(int num, int value) {
+ if (num < 0 || num > 4095) {
+ logger.error("setGPR(" + num + ", " + value + "): invalid GPR");
+ throw new IllegalArgumentException("GPR " + num + " is not supported.");
+ }
Libbluray.writeGPR(num, value);
}
@@ -64,4 +79,6 @@ public class RegisterAccess {
public static final int PSR_PLAYER_PROFILE = 31;
private static final RegisterAccess instance = new RegisterAccess();
+
+ private static final Logger logger = Logger.getLogger(RegisterAccess.class.getName());
}
More information about the libbluray-devel
mailing list