Fix: crash when opening a damaged base-graphics (#11275)

This commit is contained in:
Patric Stout 2023-09-09 16:06:00 +02:00 committed by GitHub
parent afc1ea8135
commit c3918838f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -146,9 +146,10 @@ void RandomAccessFile::ReadBlock(void *ptr, size_t size)
* Skip \a n bytes ahead in the file.
* @param n Number of bytes to skip reading.
*/
void RandomAccessFile::SkipBytes(int n)
void RandomAccessFile::SkipBytes(size_t n)
{
int remaining = this->buffer_end - this->buffer;
assert(this->buffer_end >= this->buffer);
size_t remaining = this->buffer_end - this->buffer;
if (n <= remaining) {
this->buffer += n;
} else {

View File

@ -51,7 +51,7 @@ public:
uint32_t ReadDword();
void ReadBlock(void *ptr, size_t size);
void SkipBytes(int n);
void SkipBytes(size_t n);
};
#endif /* RANDOM_ACCESS_FILE_TYPE_H */