Don't allocate an array of size 0, it causes a UBSan failure
Bug: webrtc:9587 Change-Id: I56bdf3c5c8744044b2d0d1fa3531fca504ea200f Reviewed-on: https://webrtc-review.googlesource.com/92091 Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Oleh Prypin <oprypin@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24178}
This commit is contained in:
@ -87,7 +87,7 @@ class BufferT {
|
||||
BufferT(size_t size, size_t capacity)
|
||||
: size_(size),
|
||||
capacity_(std::max(size, capacity)),
|
||||
data_(new T[capacity_]) {
|
||||
data_(capacity_ > 0 ? new T[capacity_] : nullptr) {
|
||||
RTC_DCHECK(IsConsistent());
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user