Mark methods_stream as const.

Function pointer tables require relocations, so this goes into
.data.rel.ro, not .rodata, but this will at least mark the pages
read-only after relocations are resolved.

Bug: None
Change-Id: I8625e7466b2dcadafc4e4e5f9c6eccbd87af7109
Reviewed-on: https://webrtc-review.googlesource.com/4580
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20029}
This commit is contained in:
David Benjamin 2017-09-28 16:42:58 -04:00 committed by Commit Bot
parent a8f7376789
commit 85aa0b62dd

View File

@ -165,16 +165,14 @@ static long stream_ctrl(BIO* h, int cmd, long arg1, void* arg2);
static int stream_new(BIO* h);
static int stream_free(BIO* data);
// TODO(davidben): This should be const once BoringSSL is assumed.
static BIO_METHOD methods_stream = {
static const BIO_METHOD methods_stream = {
BIO_TYPE_BIO, "stream", stream_write, stream_read, stream_puts, 0,
stream_ctrl, stream_new, stream_free, nullptr,
};
static BIO_METHOD* BIO_s_stream() { return(&methods_stream); }
static BIO* BIO_new_stream(StreamInterface* stream) {
BIO* ret = BIO_new(BIO_s_stream());
// TODO(davidben): Remove the const_cast when BoringSSL is assumed.
BIO* ret = BIO_new(const_cast<BIO_METHOD*>(&methods_stream));
if (ret == nullptr)
return nullptr;
ret->ptr = stream;