mkvparser/UnserializeInt: fix sign flip
with -funsigned-char the sign will be flipped, e.g., -128 -> 128, use an explicit signed char. additionally drop the misguided range check; this is meant as a data size limit not one for the big-endian encoded ints Change-Id: Ia10ef811d16acd09cbcd3d95856d9c460c9b7f16
This commit is contained in:
parent
fa2aa7da2d
commit
13ccc7f089
@ -17,10 +17,6 @@
|
||||
#pragma warning(disable : 4996)
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
const long long kMaxEbmlSigned64Bit = (1LL << 56) - 2;
|
||||
}
|
||||
|
||||
mkvparser::IMkvReader::~IMkvReader() {}
|
||||
|
||||
void mkvparser::GetVersion(int& major, int& minor, int& build, int& revision) {
|
||||
@ -218,7 +214,7 @@ long mkvparser::UnserializeInt(IMkvReader* pReader, long long pos,
|
||||
if (!pReader || pos < 0 || size < 1 || size > 8)
|
||||
return E_FILE_FORMAT_INVALID;
|
||||
|
||||
char first_byte = 0;
|
||||
signed char first_byte = 0;
|
||||
const long status = pReader->Read(pos, 1, (unsigned char*)&first_byte);
|
||||
|
||||
if (status < 0)
|
||||
@ -241,9 +237,6 @@ long mkvparser::UnserializeInt(IMkvReader* pReader, long long pos,
|
||||
++pos;
|
||||
}
|
||||
|
||||
if (result > kMaxEbmlSigned64Bit)
|
||||
return E_FILE_FORMAT_INVALID;
|
||||
|
||||
result_ref = static_cast<long long>(result);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user