diff options
author | Alex Klyubin <klyubin@google.com> | 2015-06-18 12:39:44 -0700 |
---|---|---|
committer | Alex Klyubin <klyubin@google.com> | 2015-06-18 12:39:44 -0700 |
commit | 61c83317f1c8f18fd86afe0c776d16933816a83a (patch) | |
tree | 0035632ea3ff8222d1be7630ec0cecb4e909c222 /media/libmedia/IMediaHTTPConnection.cpp | |
parent | 3fc792fe36b0b9100f74185665221b37f650ff65 (diff) | |
download | frameworks_av-61c83317f1c8f18fd86afe0c776d16933816a83a.zip frameworks_av-61c83317f1c8f18fd86afe0c776d16933816a83a.tar.gz frameworks_av-61c83317f1c8f18fd86afe0c776d16933816a83a.tar.bz2 |
readAt can return negative values (error codes).
This fixes the regression introduced in
59cea2616269f34b1f3d046995efd8da42cd5549 due to which MediaPlayer
treated all error codes returned by MediaHTTPConnection as
ERROR_OUT_OF_RANGE.
The regression was caused by accidentally converting negative values
(which represent error codes) returned by MediaHTTPConnection to very
large positive ones (which represent length of data received).
Bug: 21922241
Change-Id: I1b4592b5fec724aac1ba6c1ff8fdabcba56bcd2d
Diffstat (limited to 'media/libmedia/IMediaHTTPConnection.cpp')
-rw-r--r-- | media/libmedia/IMediaHTTPConnection.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/media/libmedia/IMediaHTTPConnection.cpp b/media/libmedia/IMediaHTTPConnection.cpp index 7e89d7f..0dda0be 100644 --- a/media/libmedia/IMediaHTTPConnection.cpp +++ b/media/libmedia/IMediaHTTPConnection.cpp @@ -107,7 +107,14 @@ struct BpMediaHTTPConnection : public BpInterface<IMediaHTTPConnection> { return UNKNOWN_ERROR; } - size_t len = reply.readInt32(); + int32_t lenOrErrorCode = reply.readInt32(); + + // Negative values are error codes + if (lenOrErrorCode < 0) { + return lenOrErrorCode; + } + + size_t len = lenOrErrorCode; if (len > size) { ALOGE("requested %zu, got %zu", size, len); |