|
|
4db80a |
From c6ae9afd73c183231f39804de184e8c5c09de563 Mon Sep 17 00:00:00 2001
|
|
|
4db80a |
From: Xavier Bachelot <xavier@bachelot.org>
|
|
|
4db80a |
Date: Wed, 23 Oct 2013 16:56:08 +0000
|
|
|
4db80a |
Subject: [PATCH] Fix off-by-one errors in registers
|
|
|
4db80a |
|
|
|
4db80a |
Reported by Florian Weimer.
|
|
|
4db80a |
https://bugzilla.redhat.com/show_bug.cgi?id=959215
|
|
|
4db80a |
---
|
|
|
4db80a |
src/libbluray/register.c | 8 ++++----
|
|
|
4db80a |
1 file changed, 4 insertions(+), 4 deletions(-)
|
|
|
4db80a |
|
|
|
4db80a |
diff --git a/src/libbluray/register.c b/src/libbluray/register.c
|
|
|
4db80a |
index 4985cc99..43751d4d 100644
|
|
|
4db80a |
--- a/src/libbluray/register.c
|
|
|
4db80a |
+++ b/src/libbluray/register.c
|
|
|
4db80a |
@@ -339,7 +339,7 @@ void bd_psr_restore_state(BD_REGISTERS *p)
|
|
|
4db80a |
|
|
|
4db80a |
int bd_gpr_write(BD_REGISTERS *p, int reg, uint32_t val)
|
|
|
4db80a |
{
|
|
|
4db80a |
- if (reg < 0 || reg > BD_GPR_COUNT) {
|
|
|
4db80a |
+ if (reg < 0 || reg >= BD_GPR_COUNT) {
|
|
|
4db80a |
BD_DEBUG(DBG_BLURAY, "bd_gpr_write(%d): invalid register\n", reg);
|
|
|
4db80a |
return -1;
|
|
|
4db80a |
}
|
|
|
4db80a |
@@ -350,7 +350,7 @@ int bd_gpr_write(BD_REGISTERS *p, int reg, uint32_t val)
|
|
|
4db80a |
|
|
|
4db80a |
uint32_t bd_gpr_read(BD_REGISTERS *p, int reg)
|
|
|
4db80a |
{
|
|
|
4db80a |
- if (reg < 0 || reg > BD_GPR_COUNT) {
|
|
|
4db80a |
+ if (reg < 0 || reg >= BD_GPR_COUNT) {
|
|
|
4db80a |
BD_DEBUG(DBG_BLURAY, "bd_gpr_read(%d): invalid register\n", reg);
|
|
|
4db80a |
return -1;
|
|
|
4db80a |
}
|
|
|
4db80a |
@@ -366,7 +366,7 @@ uint32_t bd_psr_read(BD_REGISTERS *p, int reg)
|
|
|
4db80a |
{
|
|
|
4db80a |
uint32_t val;
|
|
|
4db80a |
|
|
|
4db80a |
- if (reg < 0 || reg > BD_PSR_COUNT) {
|
|
|
4db80a |
+ if (reg < 0 || reg >= BD_PSR_COUNT) {
|
|
|
4db80a |
BD_DEBUG(DBG_BLURAY, "bd_psr_read(%d): invalid register\n", reg);
|
|
|
4db80a |
return -1;
|
|
|
4db80a |
}
|
|
|
4db80a |
@@ -382,7 +382,7 @@ uint32_t bd_psr_read(BD_REGISTERS *p, int reg)
|
|
|
4db80a |
|
|
|
4db80a |
int bd_psr_setting_write(BD_REGISTERS *p, int reg, uint32_t val)
|
|
|
4db80a |
{
|
|
|
4db80a |
- if (reg < 0 || reg > BD_PSR_COUNT) {
|
|
|
4db80a |
+ if (reg < 0 || reg >= BD_PSR_COUNT) {
|
|
|
4db80a |
BD_DEBUG(DBG_BLURAY, "bd_psr_write(%d, %d): invalid register\n", reg, val);
|
|
|
4db80a |
return -1;
|
|
|
4db80a |
}
|
|
|
4db80a |
--
|
|
|
4db80a |
2.26.0
|
|
|
4db80a |
|