Skip to content

Commit

Permalink
Revert "RTPFragmentationHeader::VerifyAndAllocateFragmentationHeader:…
Browse files Browse the repository at this point in the history
… Verify that size fits in 16 bits" https://webrtc-codereview.appspot.com/47229004/

Reason for revert: Breaks Chromium FYI compilation

This reverts commit 10022cd.

BUG=484432
TBR=tommi

Review URL: https://webrtc-codereview.appspot.com/54499004

Cr-Commit-Position: refs/heads/master@{#9247}
  • Loading branch information
Hnoo112233 committed May 21, 2015
1 parent 10022cd commit 848d524
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions webrtc/modules/interface/module_common_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
#include <string.h> // memcpy

#include <algorithm>
#include <limits>

#include "webrtc/base/checks.h"
#include "webrtc/base/constructormagic.h"
#include "webrtc/common_types.h"
#include "webrtc/common_video/rotation.h"
Expand Down Expand Up @@ -195,17 +193,15 @@ class RTPFragmentationHeader {
}
}

void VerifyAndAllocateFragmentationHeader(const size_t size) {
CHECK(size <= std::numeric_limits<uint16_t>::max());
const uint16_t size16 = static_cast<uint16_t>(size);
if (fragmentationVectorSize < size16) {
void VerifyAndAllocateFragmentationHeader(const uint16_t size) {
if (fragmentationVectorSize < size) {
uint16_t oldVectorSize = fragmentationVectorSize;
{
// offset
size_t* oldOffsets = fragmentationOffset;
fragmentationOffset = new size_t[size16];
fragmentationOffset = new size_t[size];
memset(fragmentationOffset + oldVectorSize, 0,
sizeof(size_t) * (size16 - oldVectorSize));
sizeof(size_t) * (size - oldVectorSize));
// copy old values
memcpy(fragmentationOffset, oldOffsets,
sizeof(size_t) * oldVectorSize);
Expand All @@ -214,34 +210,34 @@ class RTPFragmentationHeader {
// length
{
size_t* oldLengths = fragmentationLength;
fragmentationLength = new size_t[size16];
fragmentationLength = new size_t[size];
memset(fragmentationLength + oldVectorSize, 0,
sizeof(size_t) * (size16 - oldVectorSize));
sizeof(size_t) * (size - oldVectorSize));
memcpy(fragmentationLength, oldLengths,
sizeof(size_t) * oldVectorSize);
delete[] oldLengths;
}
// time diff
{
uint16_t* oldTimeDiffs = fragmentationTimeDiff;
fragmentationTimeDiff = new uint16_t[size16];
fragmentationTimeDiff = new uint16_t[size];
memset(fragmentationTimeDiff + oldVectorSize, 0,
sizeof(uint16_t) * (size16 - oldVectorSize));
sizeof(uint16_t) * (size - oldVectorSize));
memcpy(fragmentationTimeDiff, oldTimeDiffs,
sizeof(uint16_t) * oldVectorSize);
delete[] oldTimeDiffs;
}
// payload type
{
uint8_t* oldTimePlTypes = fragmentationPlType;
fragmentationPlType = new uint8_t[size16];
fragmentationPlType = new uint8_t[size];
memset(fragmentationPlType + oldVectorSize, 0,
sizeof(uint8_t) * (size16 - oldVectorSize));
sizeof(uint8_t) * (size - oldVectorSize));
memcpy(fragmentationPlType, oldTimePlTypes,
sizeof(uint8_t) * oldVectorSize);
delete[] oldTimePlTypes;
}
fragmentationVectorSize = size16;
fragmentationVectorSize = size;
}
}

Expand Down

0 comments on commit 848d524

Please sign in to comment.