Avoid reading at negative offsets

PlayerServiceFileSource had the same logic as FileSource that could
cause reading at negative data source offsets, so fix that too.

Test: build
Bug: 141242340
Change-Id: I60226d85ece83339444d9ec1c0a741271e33e127
gugelfrei
Marco Nelissen 4 years ago
parent 04e4465aa7
commit 1b41d44972

@ -71,6 +71,9 @@ ssize_t PlayerServiceFileSource::readAt(off64_t offset, void *data, size_t size)
Mutex::Autolock autoLock(mLock);
if (mLength >= 0) {
if (offset < 0) {
return UNKNOWN_ERROR;
}
if (offset >= mLength) {
return 0; // read beyond EOF.
}

Loading…
Cancel
Save