Revert "RTPFragmentationHeader::VerifyAndAllocateFragmentationHeader: Verify that size fits in 16 bits" https://webrtc-codereview.appspot.com/47229004/
Reason for revert: Breaks Chromium FYI compilation
This reverts commit 10022cdeae.
BUG=484432
TBR=tommi
Review URL: https://webrtc-codereview.appspot.com/54499004
Cr-Commit-Position: refs/heads/master@{#9247}
			
			
This commit is contained in:
		| @@ -15,9 +15,7 @@ | |||||||
| #include <string.h>  // memcpy | #include <string.h>  // memcpy | ||||||
|  |  | ||||||
| #include <algorithm> | #include <algorithm> | ||||||
| #include <limits> |  | ||||||
|  |  | ||||||
| #include "webrtc/base/checks.h" |  | ||||||
| #include "webrtc/base/constructormagic.h" | #include "webrtc/base/constructormagic.h" | ||||||
| #include "webrtc/common_types.h" | #include "webrtc/common_types.h" | ||||||
| #include "webrtc/common_video/rotation.h" | #include "webrtc/common_video/rotation.h" | ||||||
| @@ -195,17 +193,15 @@ class RTPFragmentationHeader { | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   void VerifyAndAllocateFragmentationHeader(const size_t size) { |   void VerifyAndAllocateFragmentationHeader(const uint16_t size) { | ||||||
|     CHECK(size <= std::numeric_limits<uint16_t>::max()); |     if (fragmentationVectorSize < size) { | ||||||
|     const uint16_t size16 = static_cast<uint16_t>(size); |  | ||||||
|     if (fragmentationVectorSize < size16) { |  | ||||||
|       uint16_t oldVectorSize = fragmentationVectorSize; |       uint16_t oldVectorSize = fragmentationVectorSize; | ||||||
|       { |       { | ||||||
|         // offset |         // offset | ||||||
|         size_t* oldOffsets = fragmentationOffset; |         size_t* oldOffsets = fragmentationOffset; | ||||||
|         fragmentationOffset = new size_t[size16]; |         fragmentationOffset = new size_t[size]; | ||||||
|         memset(fragmentationOffset + oldVectorSize, 0, |         memset(fragmentationOffset + oldVectorSize, 0, | ||||||
|                sizeof(size_t) * (size16 - oldVectorSize)); |                sizeof(size_t) * (size - oldVectorSize)); | ||||||
|         // copy old values |         // copy old values | ||||||
|         memcpy(fragmentationOffset, oldOffsets, |         memcpy(fragmentationOffset, oldOffsets, | ||||||
|                sizeof(size_t) * oldVectorSize); |                sizeof(size_t) * oldVectorSize); | ||||||
| @@ -214,9 +210,9 @@ class RTPFragmentationHeader { | |||||||
|       // length |       // length | ||||||
|       { |       { | ||||||
|         size_t* oldLengths = fragmentationLength; |         size_t* oldLengths = fragmentationLength; | ||||||
|         fragmentationLength = new size_t[size16]; |         fragmentationLength = new size_t[size]; | ||||||
|         memset(fragmentationLength + oldVectorSize, 0, |         memset(fragmentationLength + oldVectorSize, 0, | ||||||
|                sizeof(size_t) * (size16 - oldVectorSize)); |                sizeof(size_t) * (size - oldVectorSize)); | ||||||
|         memcpy(fragmentationLength, oldLengths, |         memcpy(fragmentationLength, oldLengths, | ||||||
|                sizeof(size_t) * oldVectorSize); |                sizeof(size_t) * oldVectorSize); | ||||||
|         delete[] oldLengths; |         delete[] oldLengths; | ||||||
| @@ -224,9 +220,9 @@ class RTPFragmentationHeader { | |||||||
|       // time diff |       // time diff | ||||||
|       { |       { | ||||||
|         uint16_t* oldTimeDiffs = fragmentationTimeDiff; |         uint16_t* oldTimeDiffs = fragmentationTimeDiff; | ||||||
|         fragmentationTimeDiff = new uint16_t[size16]; |         fragmentationTimeDiff = new uint16_t[size]; | ||||||
|         memset(fragmentationTimeDiff + oldVectorSize, 0, |         memset(fragmentationTimeDiff + oldVectorSize, 0, | ||||||
|                sizeof(uint16_t) * (size16 - oldVectorSize)); |                sizeof(uint16_t) * (size - oldVectorSize)); | ||||||
|         memcpy(fragmentationTimeDiff, oldTimeDiffs, |         memcpy(fragmentationTimeDiff, oldTimeDiffs, | ||||||
|                sizeof(uint16_t) * oldVectorSize); |                sizeof(uint16_t) * oldVectorSize); | ||||||
|         delete[] oldTimeDiffs; |         delete[] oldTimeDiffs; | ||||||
| @@ -234,14 +230,14 @@ class RTPFragmentationHeader { | |||||||
|       // payload type |       // payload type | ||||||
|       { |       { | ||||||
|         uint8_t* oldTimePlTypes = fragmentationPlType; |         uint8_t* oldTimePlTypes = fragmentationPlType; | ||||||
|         fragmentationPlType = new uint8_t[size16]; |         fragmentationPlType = new uint8_t[size]; | ||||||
|         memset(fragmentationPlType + oldVectorSize, 0, |         memset(fragmentationPlType + oldVectorSize, 0, | ||||||
|                sizeof(uint8_t) * (size16 - oldVectorSize)); |                sizeof(uint8_t) * (size - oldVectorSize)); | ||||||
|         memcpy(fragmentationPlType, oldTimePlTypes, |         memcpy(fragmentationPlType, oldTimePlTypes, | ||||||
|                sizeof(uint8_t) * oldVectorSize); |                sizeof(uint8_t) * oldVectorSize); | ||||||
|         delete[] oldTimePlTypes; |         delete[] oldTimePlTypes; | ||||||
|       } |       } | ||||||
|       fragmentationVectorSize = size16; |       fragmentationVectorSize = size; | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Magnus Jedvert
					Magnus Jedvert