mirror of
https://github.com/hasherezade/bearparser
synced 2026-06-08 14:32:38 +00:00
[FEATURE] In AbstractByteBuffer: more detailed error message
This commit is contained in:
@@ -70,12 +70,14 @@ BYTE* AbstractByteBuffer::getContentAt(offset_t offset, bufsize_t size, bool all
|
||||
if (buf == NULL) return NULL;
|
||||
|
||||
if (offset >= fileSize ) {
|
||||
if (allowExceptions) throw BufferException("Too far offset requested!");
|
||||
if (allowExceptions) throw BufferException("Too far offset requested! Buffer size: "
|
||||
+ QString::number(fileSize) + " vs reguested Offset: " + QString::number(offset));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (offset + size > fileSize) {
|
||||
if (allowExceptions) throw BufferException("Too big size requested!");
|
||||
offset_t endOffset = offset + size;
|
||||
if (endOffset > fileSize) {
|
||||
if (allowExceptions) throw BufferException("Too big size requested! Buffer size: "
|
||||
+ QString::number(fileSize) + " vs requested Size: " + QString::number(endOffset));
|
||||
return NULL;
|
||||
}
|
||||
BYTE *cntnt = buf + offset;
|
||||
|
||||
Reference in New Issue
Block a user