Skip to content

Commit

Permalink
Add checks for string sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
peak3d committed Feb 8, 2019
1 parent 06cf64f commit f782dcc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion wvdecrypter/wvdecrypter.cpp
Expand Up @@ -880,7 +880,7 @@ bool WV_CencSingleSampleDecrypter::SendSessionMessage()

if (!blocks[3].empty() && !serverCertRequest)
{
if (blocks[3][0] == 'J' || (blocks[3][0] == 'B' && blocks[3][1] == 'J'))
if (blocks[3][0] == 'J' || (blocks[3].size() > 1 && blocks[3][0] == 'B' && blocks[3][1] == 'J'))
{
int dataPos = 2;

Expand Down
2 changes: 1 addition & 1 deletion wvdecrypter/wvdecrypter_android.cpp
Expand Up @@ -683,7 +683,7 @@ bool WV_CencSingleSampleDecrypter::SendSessionMessage(AMediaDrmByteArray &sessio

if (!blocks[3].empty())
{
if (blocks[3][0] == 'J' || (blocks[3][0] == 'B' && blocks[3][1] == 'J'))
if (blocks[3][0] == 'J' || ((blocks[3].size() > 1 && blocks[3][0] == 'B' && blocks[3][1] == 'J'))
{
int dataPos = 2;

Expand Down
2 changes: 1 addition & 1 deletion wvdecrypter/wvdecrypter_android_jni.cpp
Expand Up @@ -784,7 +784,7 @@ bool WV_CencSingleSampleDecrypter::SendSessionMessage(const std::vector<char> &k

if (!blocks[3].empty() && (keyRequestData.size() > 2 || contentType.find("application/octet-stream") == std::string::npos))
{
if (blocks[3][0] == 'J' || (blocks[3][0] == 'B' && blocks[3][1] == 'J'))
if (blocks[3][0] == 'J' || (blocks[3].size() > 1 && blocks[3][0] == 'B' && blocks[3][1] == 'J'))
{
int dataPos = 2;

Expand Down

0 comments on commit f782dcc

Please sign in to comment.