Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

6 months worth of security patches! #4

Open
wants to merge 3 commits into
base: 12.1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions media/codec2/vndk/platform/C2SurfaceSyncObj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ std::shared_ptr<C2SurfaceSyncMemory> C2SurfaceSyncMemory::Import(
}

HandleSyncMem *o = static_cast<HandleSyncMem*>(handle);
if (o->size() < sizeof(C2SyncVariables)) {
android_errorWriteLog(0x534e4554, "240140929");
return nullptr;
}

void *ptr = mmap(NULL, o->size(), PROT_READ | PROT_WRITE, MAP_SHARED, o->memFd(), 0);

if (ptr == MAP_FAILED) {
Expand Down
14 changes: 9 additions & 5 deletions media/libstagefright/NuMediaExtractor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -639,9 +639,11 @@ status_t NuMediaExtractor::appendVorbisNumPageSamples(
numPageSamples = -1;
}

// insert, including accounting for the space used.
memcpy((uint8_t *)buffer->data() + mbuf->range_length(),
&numPageSamples,
sizeof(numPageSamples));
buffer->setRange(buffer->offset(), buffer->size() + sizeof(numPageSamples));

uint32_t type;
const void *data;
Expand Down Expand Up @@ -690,6 +692,8 @@ status_t NuMediaExtractor::readSampleData(const sp<ABuffer> &buffer) {

ssize_t minIndex = fetchAllTrackSamples();

buffer->setRange(0, 0); // start with an empty buffer

if (minIndex < 0) {
return ERROR_END_OF_STREAM;
}
Expand All @@ -705,25 +709,25 @@ status_t NuMediaExtractor::readSampleData(const sp<ABuffer> &buffer) {
sampleSize += sizeof(int32_t);
}

// capacity() is ok since we cleared out the buffer
if (buffer->capacity() < sampleSize) {
return -ENOMEM;
}

const size_t srclen = it->mBuffer->range_length();
const uint8_t *src =
(const uint8_t *)it->mBuffer->data()
+ it->mBuffer->range_offset();

memcpy((uint8_t *)buffer->data(), src, it->mBuffer->range_length());
memcpy((uint8_t *)buffer->data(), src, srclen);
buffer->setRange(0, srclen);

status_t err = OK;
if (info->mTrackFlags & kIsVorbis) {
// adjusts range when it inserts the extra bits
err = appendVorbisNumPageSamples(it->mBuffer, buffer);
}

if (err == OK) {
buffer->setRange(0, sampleSize);
}

return err;
}

Expand Down
21 changes: 21 additions & 0 deletions services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -711,8 +711,29 @@ Status AudioPolicyService::startInput(int32_t portIdAidl)

Mutex::Autolock _l(mLock);

ALOGW_IF(client->silenced, "startInput on silenced input for port %d, uid %d. Unsilencing.",
portIdAidl,
client->attributionSource.uid);

if (client->active) {
ALOGE("Client should never be active before startInput. Uid %d port %d",
client->attributionSource.uid, portId);
finishRecording(client->attributionSource, client->attributes.source);
return binderStatusFromStatusT(INVALID_OPERATION);
}

// Force the possibly silenced client to be unsilenced since we just called
// startRecording (i.e. we have assumed it is unsilenced).
// At this point in time, the client is inactive, so no calls to appops are sent in
// setAppState_l.
// This ensures existing clients have the same behavior as new clients (starting unsilenced).
// TODO(b/282076713)
setAppState_l(client, APP_STATE_TOP);

client->active = true;
client->startTimeNs = systemTime();
// This call updates the silenced state, and since we are active, appropriately notifies appops
// if we silence the track.
updateUidStates_l();

status_t status;
Expand Down