diff options
author | Gloria Wang <gwang@google.com> | 2011-02-24 16:40:57 -0800 |
---|---|---|
committer | Gloria Wang <gwang@google.com> | 2011-03-10 16:20:48 -0800 |
commit | b5ce361d19e69fe156f7188c9ee0f4734b259874 (patch) | |
tree | 1536e63d3394cbbd5c2e8bc5cde6affb2b173850 /include/drm | |
parent | 609ce04d29780c430ff7e17511fc073a664c02d5 (diff) | |
download | frameworks_av-b5ce361d19e69fe156f7188c9ee0f4734b259874.zip frameworks_av-b5ce361d19e69fe156f7188c9ee0f4734b259874.tar.gz frameworks_av-b5ce361d19e69fe156f7188c9ee0f4734b259874.tar.bz2 |
Fix for bug 3477330
This patch fixs a crash bug caused by using a NULL DecryptHandle pointer.
Fix by using sp<DecryptHandle> instead.
Change-Id: Icbd59858385e8256125a615a3c82656b25319d44
Diffstat (limited to 'include/drm')
-rw-r--r-- | include/drm/DrmManagerClient.h | 21 | ||||
-rw-r--r-- | include/drm/drm_framework_common.h | 10 |
2 files changed, 20 insertions, 11 deletions
diff --git a/include/drm/DrmManagerClient.h b/include/drm/DrmManagerClient.h index 085ebf1..044ff0e 100644 --- a/include/drm/DrmManagerClient.h +++ b/include/drm/DrmManagerClient.h @@ -69,7 +69,7 @@ public: * @return * Handle for the decryption session */ - DecryptHandle* openDecryptSession(int fd, off64_t offset, off64_t length); + sp<DecryptHandle> openDecryptSession(int fd, off64_t offset, off64_t length); /** * Open the decrypt session to decrypt the given protected content @@ -78,7 +78,7 @@ public: * @return * Handle for the decryption session */ - DecryptHandle* openDecryptSession(const char* uri); + sp<DecryptHandle> openDecryptSession(const char* uri); /** * Close the decrypt session for the given handle @@ -87,7 +87,7 @@ public: * @return status_t * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ - status_t closeDecryptSession(DecryptHandle* decryptHandle); + status_t closeDecryptSession(sp<DecryptHandle> &decryptHandle); /** * Consumes the rights for a content. @@ -101,7 +101,7 @@ public: * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure. * In case license has been expired, DRM_ERROR_LICENSE_EXPIRED will be returned. */ - status_t consumeRights(DecryptHandle* decryptHandle, int action, bool reserve); + status_t consumeRights(sp<DecryptHandle> &decryptHandle, int action, bool reserve); /** * Informs the DRM engine about the playback actions performed on the DRM files. @@ -113,7 +113,8 @@ public: * @return status_t * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ - status_t setPlaybackStatus(DecryptHandle* decryptHandle, int playbackStatus, int64_t position); + status_t setPlaybackStatus( + sp<DecryptHandle> &decryptHandle, int playbackStatus, int64_t position); /** * Initialize decryption for the given unit of the protected content @@ -125,7 +126,7 @@ public: * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ status_t initializeDecryptUnit( - DecryptHandle* decryptHandle, int decryptUnitId, const DrmBuffer* headerInfo); + sp<DecryptHandle> &decryptHandle, int decryptUnitId, const DrmBuffer* headerInfo); /** * Decrypt the protected content buffers for the given unit @@ -144,7 +145,7 @@ public: * DRM_ERROR_DECRYPT for failure. */ status_t decrypt( - DecryptHandle* decryptHandle, int decryptUnitId, + sp<DecryptHandle> &decryptHandle, int decryptUnitId, const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV = NULL); /** @@ -155,7 +156,8 @@ public: * @return status_t * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ - status_t finalizeDecryptUnit(DecryptHandle* decryptHandle, int decryptUnitId); + status_t finalizeDecryptUnit( + sp<DecryptHandle> &decryptHandle, int decryptUnitId); /** * Reads the specified number of bytes from an open DRM file. @@ -167,7 +169,8 @@ public: * * @return Number of bytes read. Returns -1 for Failure. */ - ssize_t pread(DecryptHandle* decryptHandle, void* buffer, ssize_t numBytes, off64_t offset); + ssize_t pread(sp<DecryptHandle> &decryptHandle, + void* buffer, ssize_t numBytes, off64_t offset); /** * Validates whether an action on the DRM content is allowed or not. diff --git a/include/drm/drm_framework_common.h b/include/drm/drm_framework_common.h index 1758cdd..3ad0330 100644 --- a/include/drm/drm_framework_common.h +++ b/include/drm/drm_framework_common.h @@ -19,6 +19,7 @@ #include <utils/Vector.h> #include <utils/KeyedVector.h> +#include <utils/RefBase.h> #include <utils/String8.h> #include <utils/Errors.h> @@ -240,7 +241,7 @@ public: /** * Defines decryption handle */ -class DecryptHandle { +class DecryptHandle : public RefBase { public: /** * Decryption session Handle @@ -285,10 +286,15 @@ public: decryptId(INVALID_VALUE), mimeType(""), decryptApiType(INVALID_VALUE), - status(INVALID_VALUE) { + status(INVALID_VALUE), + decryptInfo(NULL) { } + ~DecryptHandle() { + delete decryptInfo; decryptInfo = NULL; + } + bool operator<(const DecryptHandle& handle) const { return (decryptId < handle.decryptId); } |