Commit 14f1b33f by eguven Committed by Oliver Woodman

Make CacheDataSource.open() throw exception if resolved range doesn't cover position

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=151006826
parent 7aff6244
...@@ -181,6 +181,9 @@ public final class CacheDataSource implements DataSource { ...@@ -181,6 +181,9 @@ public final class CacheDataSource implements DataSource {
bytesRemaining = cache.getContentLength(key); bytesRemaining = cache.getContentLength(key);
if (bytesRemaining != C.LENGTH_UNSET) { if (bytesRemaining != C.LENGTH_UNSET) {
bytesRemaining -= dataSpec.position; bytesRemaining -= dataSpec.position;
if (bytesRemaining <= 0) {
throw new DataSourceException(DataSourceException.POSITION_OUT_OF_RANGE);
}
} }
} }
openNextSource(true); openNextSource(true);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment