Fix overflowing on methods that take an offset as argument

This commit is contained in:
Brogolem35
2026-03-06 18:53:26 +03:00
parent c4969dfa4e
commit 36c91c7a4a
+2 -2
View File
@@ -78,7 +78,7 @@ public:
int copy(T *p_buf, int p_offset, int p_size) const {
int left = data_left();
if ((p_offset + p_size) > left) {
p_size -= left - p_offset;
p_size = left - p_offset;
if (p_size <= 0) {
return 0;
}
@@ -104,7 +104,7 @@ public:
int find(const T &t, int p_offset, int p_max_size) const {
int left = data_left();
if ((p_offset + p_max_size) > left) {
p_max_size -= left - p_offset;
p_max_size = left - p_offset;
if (p_max_size <= 0) {
return 0;
}