summaryrefslogtreecommitdiffstats
path: root/gfx/ots/src/ots.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
commitfbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch)
tree4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /gfx/ots/src/ots.h
parentReleasing progress-linux version 124.0.1-1~progress7.99u1. (diff)
downloadfirefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz
firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/ots/src/ots.h')
-rw-r--r--gfx/ots/src/ots.h13
1 files changed, 6 insertions, 7 deletions
diff --git a/gfx/ots/src/ots.h b/gfx/ots/src/ots.h
index 434e068d48..7e3625c737 100644
--- a/gfx/ots/src/ots.h
+++ b/gfx/ots/src/ots.h
@@ -87,8 +87,7 @@ class Buffer {
if (n_bytes > 1024 * 1024 * 1024) {
return OTS_FAILURE();
}
- if ((offset_ + n_bytes > length_) ||
- (offset_ > length_ - n_bytes)) {
+ if (length_ < n_bytes || offset_ > length_ - n_bytes) {
return OTS_FAILURE();
}
if (buf) {
@@ -99,7 +98,7 @@ class Buffer {
}
inline bool ReadU8(uint8_t *value) {
- if (offset_ + 1 > length_) {
+ if (length_ < 1 || offset_ > length_ - 1) {
return OTS_FAILURE();
}
*value = buffer_[offset_];
@@ -108,7 +107,7 @@ class Buffer {
}
bool ReadU16(uint16_t *value) {
- if (offset_ + 2 > length_) {
+ if (length_ < 2 || offset_ > length_ - 2) {
return OTS_FAILURE();
}
std::memcpy(value, buffer_ + offset_, sizeof(uint16_t));
@@ -122,7 +121,7 @@ class Buffer {
}
bool ReadU24(uint32_t *value) {
- if (offset_ + 3 > length_) {
+ if (length_ < 3 || offset_ > length_ - 3) {
return OTS_FAILURE();
}
*value = static_cast<uint32_t>(buffer_[offset_]) << 16 |
@@ -133,7 +132,7 @@ class Buffer {
}
bool ReadU32(uint32_t *value) {
- if (offset_ + 4 > length_) {
+ if (length_ < 4 || offset_ > length_ - 4) {
return OTS_FAILURE();
}
std::memcpy(value, buffer_ + offset_, sizeof(uint32_t));
@@ -147,7 +146,7 @@ class Buffer {
}
bool ReadR64(uint64_t *value) {
- if (offset_ + 8 > length_) {
+ if (length_ < 8 || offset_ > length_ - 8) {
return OTS_FAILURE();
}
std::memcpy(value, buffer_ + offset_, sizeof(uint64_t));