Permalink
Browse files

(TEST) Stagefright patches v1

  • Loading branch information...
chevycam94 committed Oct 11, 2015
1 parent 357ba0d commit 7c36e67841938423e102270fd10e9a06bbd64382
@@ -2701,7 +2701,7 @@ extern "C" int Effect_command(effect_interface_t self,
switch (cmdCode){
case EFFECT_CMD_INIT:
if (pReplyData == NULL || *replySize != sizeof(int)){
if (pReplyData == NULL || replySize == NULL || *replySize != sizeof(int)){
LOGV("\tLVM_ERROR, EFFECT_CMD_INIT: ERROR for effect type %d",
pContext->EffectType);
return -EINVAL;
@@ -2749,11 +2749,13 @@ extern "C" int Effect_command(effect_interface_t self,
case EFFECT_CMD_GET_PARAM:{
//LOGV("\tEffect_command cmdCode Case: EFFECT_CMD_GET_PARAM start");
if(pContext->EffectType == LVM_BASS_BOOST){
if (pCmdData == NULL ||
cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t)) ||
pReplyData == NULL ||
*replySize < (int) (sizeof(effect_param_t) + sizeof(int32_t))){
effect_param_t *p = (effect_param_t *)pCmdData;
if (pCmdData == NULL || cmdSize < sizeof(effect_param_t) ||
cmdSize < (sizeof(effect_param_t) + p->psize) ||
pReplyData == NULL || replySize == NULL ||
*replySize < (sizeof(effect_param_t) + p->psize)) {
LOGV("\tLVM_ERROR : BassBoost_command cmdCode Case: "
"EFFECT_CMD_GET_PARAM: ERROR");
return -EINVAL;
@@ -2766,13 +2768,13 @@ extern "C" int Effect_command(effect_interface_t self,
int voffset = ((p->psize - 1) / sizeof(int32_t) + 1) * sizeof(int32_t);
if(pContext->EffectType == LVM_BASS_BOOST){
p->status = android::BassBoost_getParameter(pContext,
p->data,
(size_t *)&p->vsize,
p->data + voffset);
*replySize = sizeof(effect_param_t) + voffset + p->vsize;
//LOGV("\tBassBoost_command EFFECT_CMD_GET_PARAM "
// "*pCmdData %d, *replySize %d, *pReplyData %d ",
// *(int32_t *)((char *)pCmdData + sizeof(effect_param_t)),
@@ -2781,29 +2783,12 @@ extern "C" int Effect_command(effect_interface_t self,
}
if(pContext->EffectType == LVM_VIRTUALIZER){
if (pCmdData == NULL ||
cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t)) ||
pReplyData == NULL ||
*replySize < (int) (sizeof(effect_param_t) + sizeof(int32_t))){
LOGV("\tLVM_ERROR : Virtualizer_command cmdCode Case: "
"EFFECT_CMD_GET_PARAM: ERROR");
return -EINVAL;
}
effect_param_t *p = (effect_param_t *)pCmdData;
memcpy(pReplyData, pCmdData, sizeof(effect_param_t) + p->psize);
p = (effect_param_t *)pReplyData;
int voffset = ((p->psize - 1) / sizeof(int32_t) + 1) * sizeof(int32_t);
p->status = android::Virtualizer_getParameter(pContext,
(void *)p->data,
(size_t *)&p->vsize,
p->data + voffset);
*replySize = sizeof(effect_param_t) + voffset + p->vsize;
//LOGV("\tVirtualizer_command EFFECT_CMD_GET_PARAM "
// "*pCmdData %d, *replySize %d, *pReplyData %d ",
// *(int32_t *)((char *)pCmdData + sizeof(effect_param_t)),
@@ -2813,29 +2798,12 @@ extern "C" int Effect_command(effect_interface_t self,
if(pContext->EffectType == LVM_EQUALIZER){
//LOGV("\tEqualizer_command cmdCode Case: "
// "EFFECT_CMD_GET_PARAM start");
if (pCmdData == NULL ||
cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t)) ||
pReplyData == NULL ||
*replySize < (int) (sizeof(effect_param_t) + sizeof(int32_t))) {
LOGV("\tLVM_ERROR : Equalizer_command cmdCode Case: "
"EFFECT_CMD_GET_PARAM");
return -EINVAL;
}
effect_param_t *p = (effect_param_t *)pCmdData;
memcpy(pReplyData, pCmdData, sizeof(effect_param_t) + p->psize);
p = (effect_param_t *)pReplyData;
int voffset = ((p->psize - 1) / sizeof(int32_t) + 1) * sizeof(int32_t);
p->status = android::Equalizer_getParameter(pContext,
p->data,
&p->vsize,
p->data + voffset);
*replySize = sizeof(effect_param_t) + voffset + p->vsize;
//LOGV("\tEqualizer_command EFFECT_CMD_GET_PARAM *pCmdData %d, *replySize %d, "
// "*pReplyData %08x %08x",
// *(int32_t *)((char *)pCmdData + sizeof(effect_param_t)), *replySize,
@@ -2845,37 +2813,22 @@ extern "C" int Effect_command(effect_interface_t self,
}
if(pContext->EffectType == LVM_VOLUME){
//LOGV("\tVolume_command cmdCode Case: EFFECT_CMD_GET_PARAM start");
if (pCmdData == NULL ||
cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t)) ||
pReplyData == NULL ||
*replySize < (int) (sizeof(effect_param_t) + sizeof(int32_t))){
LOGV("\tLVM_ERROR : Volume_command cmdCode Case: "
"EFFECT_CMD_GET_PARAM: ERROR");
return -EINVAL;
}
effect_param_t *p = (effect_param_t *)pCmdData;
memcpy(pReplyData, pCmdData, sizeof(effect_param_t) + p->psize);
p = (effect_param_t *)pReplyData;
int voffset = ((p->psize - 1) / sizeof(int32_t) + 1) * sizeof(int32_t);
p->status = android::Volume_getParameter(pContext,
(void *)p->data,
(size_t *)&p->vsize,
p->data + voffset);
*replySize = sizeof(effect_param_t) + voffset + p->vsize;
//LOGV("\tVolume_command EFFECT_CMD_GET_PARAM "
// "*pCmdData %d, *replySize %d, *pReplyData %d ",
// *(int32_t *)((char *)pCmdData + sizeof(effect_param_t)),
// *replySize,
// *(int16_t *)((char *)pReplyData + sizeof(effect_param_t) + voffset));
}
if(pContext->EffectType == LVM_BASS_BOOST){
//LOGV("\tEffect_command cmdCode Case: EFFECT_CMD_GET_PARAM end");
} break;
case EFFECT_CMD_SET_PARAM:{
//LOGV("\tEffect_command cmdCode Case: EFFECT_CMD_SET_PARAM start");
if(pContext->EffectType == LVM_BASS_BOOST){
@@ -2884,9 +2837,9 @@ extern "C" int Effect_command(effect_interface_t self,
// *replySize,
// *(int16_t *)((char *)pCmdData + sizeof(effect_param_t) + sizeof(int32_t)));
if (pCmdData == NULL||
if (pCmdData == NULL ||
cmdSize != (int)(sizeof(effect_param_t) + sizeof(int32_t) +sizeof(int16_t))||
pReplyData == NULL||
pReplyData == NULL ||
*replySize != sizeof(int32_t)){
LOGV("\tLVM_ERROR : BassBoost_command cmdCode Case: "
"EFFECT_CMD_SET_PARAM: ERROR");
@@ -2953,7 +2906,7 @@ extern "C" int Effect_command(effect_interface_t self,
// *(int16_t *)((char *)pCmdData + sizeof(effect_param_t) + sizeof(int32_t)));
if (pCmdData == NULL || cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t)) ||
pReplyData == NULL || *replySize != sizeof(int32_t)) {
pReplyData == NULL || replySize == NULL || *replySize != sizeof(int32_t)) {
LOGV("\tLVM_ERROR : Equalizer_command cmdCode Case: "
"EFFECT_CMD_SET_PARAM: ERROR");
return -EINVAL;
@@ -2971,9 +2924,9 @@ extern "C" int Effect_command(effect_interface_t self,
// *replySize,
// *(int16_t *)((char *)pCmdData + sizeof(effect_param_t) +sizeof(int32_t)));
if ( pCmdData == NULL||
cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t))||
pReplyData == NULL||
if ( pCmdData == NULL ||
cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t)) ||
pReplyData == NULL || replySize == NULL ||
*replySize != sizeof(int32_t)){
LOGV("\tLVM_ERROR : Volume_command cmdCode Case: "
"EFFECT_CMD_SET_PARAM: ERROR");
@@ -2990,7 +2943,7 @@ extern "C" int Effect_command(effect_interface_t self,
case EFFECT_CMD_ENABLE:
LOGV("\tEffect_command cmdCode Case: EFFECT_CMD_ENABLE start");
if (pReplyData == NULL || *replySize != sizeof(int)){
if (pReplyData == NULL || replySize == NULL || *replySize != sizeof(int)) {
LOGV("\tLVM_ERROR : Effect_command cmdCode Case: EFFECT_CMD_ENABLE: ERROR");
return -EINVAL;
}
@@ -3000,7 +2953,7 @@ extern "C" int Effect_command(effect_interface_t self,
case EFFECT_CMD_DISABLE:
//LOGV("\tEffect_command cmdCode Case: EFFECT_CMD_DISABLE start");
if (pReplyData == NULL || *replySize != sizeof(int)){
if (pReplyData == NULL || replySize == NULL || *replySize != sizeof(int)) {
LOGV("\tLVM_ERROR : Effect_command cmdCode Case: EFFECT_CMD_DISABLE: ERROR");
return -EINVAL;
}
@@ -3010,6 +2963,12 @@ extern "C" int Effect_command(effect_interface_t self,
case EFFECT_CMD_SET_DEVICE:
{
LOGV("\tEffect_command cmdCode Case: EFFECT_CMD_SET_DEVICE start");
if (pCmdData == NULL){
ALOGV("\tLVM_ERROR : Effect_command cmdCode Case: EFFECT_CMD_SET_DEVICE: ERROR");
return -EINVAL;
}
audio_device_e device = *(audio_device_e *)pCmdData;
if(pContext->EffectType == LVM_BASS_BOOST){
@@ -3094,8 +3053,8 @@ extern "C" int Effect_command(effect_interface_t self,
break;
}
if (pCmdData == NULL ||
cmdSize != 2 * sizeof(uint32_t)) {
if (pCmdData == NULL || cmdSize != 2 * sizeof(uint32_t) || pReplyData == NULL ||
replySize == NULL || *replySize < 2*sizeof(int32_t)) {
LOGV("\tLVM_ERROR : Effect_command cmdCode Case: "
"EFFECT_CMD_SET_VOLUME: ERROR");
return -EINVAL;
@@ -130,6 +130,8 @@ status_t ESDS::parseESDescriptor(size_t offset, size_t size) {
--size;
if (streamDependenceFlag) {
if (size < 2)
return ERROR_MALFORMED;
offset += 2;
size -= 2;
}
@@ -139,11 +141,15 @@ status_t ESDS::parseESDescriptor(size_t offset, size_t size) {
return ERROR_MALFORMED;
}
unsigned URLlength = mData[offset];
if (URLlength >= size)
return ERROR_MALFORMED;
offset += URLlength + 1;
size -= URLlength + 1;
}
if (OCRstreamFlag) {
if (size < 2)
return ERROR_MALFORMED;
offset += 2;
size -= 2;
}
@@ -159,6 +159,9 @@ status_t SampleTable::setSampleToChunkParams(
return ERROR_MALFORMED;
}
if (SIZE_MAX / sizeof(SampleToChunkEntry) <= mNumSampleToChunkOffsets)
return ERROR_OUT_OF_RANGE;
mSampleToChunkEntries =
new SampleToChunkEntry[mNumSampleToChunkOffsets];

0 comments on commit 7c36e67

Please sign in to comment.