diff options
author | Marco Nelissen <marcone@google.com> | 2016-03-21 09:29:06 -0700 |
---|---|---|
committer | Keith Mok <kmok@cyngn.com> | 2016-03-22 08:57:04 -0700 |
commit | f97015ad37e8386a4215e2d25a4196edef5f7c8d (patch) | |
tree | 9c5c562861d8bda1fd3df990e4be2789c46aeca1 | |
parent | 811391b5e9634116b88abfdcb262986e778aa436 (diff) | |
download | frameworks_av-f97015ad37e8386a4215e2d25a4196edef5f7c8d.zip frameworks_av-f97015ad37e8386a4215e2d25a4196edef5f7c8d.tar.gz frameworks_av-f97015ad37e8386a4215e2d25a4196edef5f7c8d.tar.bz2 |
Fix 64-bit comparison
A 64-bit SIZE_MAX value cast to off64_t is always negative, causing valid
files to be rejected in 64-bit mode.
Change-Id: I8f61c19951f9c73292fa917081b8b2f3bfc405a0
-rw-r--r-- | media/libstagefright/SampleTable.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/media/libstagefright/SampleTable.cpp b/media/libstagefright/SampleTable.cpp index 93cf055..2f69fd8 100644 --- a/media/libstagefright/SampleTable.cpp +++ b/media/libstagefright/SampleTable.cpp @@ -209,6 +209,11 @@ status_t SampleTable::setChunkOffsetParams( status_t SampleTable::setSampleToChunkParams( off64_t data_offset, size_t data_size) { if (mSampleToChunkOffset >= 0) { + // already set + return ERROR_MALFORMED; + } + + if (data_offset < 0) { return ERROR_MALFORMED; } @@ -246,7 +251,7 @@ status_t SampleTable::setSampleToChunkParams( for (uint32_t i = 0; i < mNumSampleToChunkOffsets; ++i) { uint8_t buffer[12]; - if ((off64_t)(SIZE_MAX - 8 - (i * 12)) < mSampleToChunkOffset) { + if ((SIZE_MAX - 8 - (i * 12)) < (size_t)mSampleToChunkOffset) { return ERROR_MALFORMED; } |