Преглед на файлове

Fix build against LLVM CFI.

The first line of bssl::New is invalid in LLVM CFI as we are casting a
pointer to T before the object is constructed. Instead, we should leave
it as void* and only use it as a T* afterward being constructed.

Bug: chromium:750445
Change-Id: I0ae60c2a7e541b45bc0155dd8f359b662f561dcc
Reviewed-on: https://boringssl-review.googlesource.com/18684
Commit-Queue: David Benjamin <davidben@google.com>
Commit-Queue: Steven Valdez <svaldez@google.com>
Reviewed-by: Steven Valdez <svaldez@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
kris/onging/CECPQ3_patch15
David Benjamin преди 7 години
committed by CQ bot account: commit-bot@chromium.org
родител
ревизия
a4cb62f0ae
променени са 1 файла, в които са добавени 2 реда и са изтрити 3 реда
  1. +2
    -3
      ssl/internal.h

+ 2
- 3
ssl/internal.h Целия файл

@@ -181,13 +181,12 @@ struct SSL_HANDSHAKE;
* Note: unlike |new|, this does not support non-public constructors. */
template <typename T, typename... Args>
T *New(Args &&... args) {
T *t = reinterpret_cast<T *>(OPENSSL_malloc(sizeof(T)));
void *t = OPENSSL_malloc(sizeof(T));
if (t == nullptr) {
OPENSSL_PUT_ERROR(SSL, ERR_R_MALLOC_FAILURE);
return nullptr;
}
new (t) T(std::forward<Args>(args)...);
return t;
return new (t) T(std::forward<Args>(args)...);
}

/* Delete behaves like |delete| but uses |OPENSSL_free| to release memory.


Зареждане…
Отказ
Запис