Skip to content

Commit 39e57be

Browse files
committed
[BUGFIX] Define LLONG_MAX as an upper bound of FileSize
1 parent c0fec05 commit 39e57be

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

parser/FileBuffer.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ ByteBuffer* AbstractFileBuffer::read(QFile &fIn, bufsize_t minBufSize, const boo
9595
bufsize_t AbstractFileBuffer::getReadableSize(QFile &fIn)
9696
{
9797
qint64 fileSize = fIn.size();
98+
if (!fileSize) return 0;
9899
if (fileSize > qint64(FILE_MAXSIZE)) {
99100
fileSize = qint64(FILE_MAXSIZE);
100101
}

parser/include/bearparser/FileBuffer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#pragma once
22
#include <QtCore>
3-
3+
#include <limits.h>
44
#include "ByteBuffer.h"
55

6-
const bufsize_t FILE_MAXSIZE = BUFSIZE_MAX;
6+
const bufsize_t FILE_MAXSIZE = (LLONG_MAX > BUFSIZE_MAX ? BUFSIZE_MAX : LLONG_MAX);
77
const bufsize_t FILEVIEW_MAXSIZE = (1024*1024*400); //419mb
88

99
class FileBufferException : public BufferException

0 commit comments

Comments
 (0)