about summary refs log tree commit diff
path: root/src/libsyntax/errors
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-09-19 17:40:56 +0000
committerbors <bors@rust-lang.org>2015-09-19 17:40:56 +0000
commit6db1a0ea7c150c0d3ac361996a993cd9548f6daa (patch)
treea53708e1068cc9dea59639448a08d169cba345bc /src/libsyntax/errors
parent0b5b029da1eb37b0478ce45587db7dc8f66b39b7 (diff)
parent9526813f5bc088261201934d7d6e574231eb252e (diff)
downloadrust-6db1a0ea7c150c0d3ac361996a993cd9548f6daa.tar.gz
rust-6db1a0ea7c150c0d3ac361996a993cd9548f6daa.zip
Auto merge of #28497 - apasel422:issue-28493, r=Gankro
When both the key and value types were zero-sized, `BTreeMap` previously
called `heap::allocate` with `size == 0` for leaf nodes, which is
undefined behavior, and jemalloc would attempt to read invalid memory,
crashing the process.

This avoids undefined behavior by allocating enough space to store one
edge in leaf nodes that would otherwise have `size == 0`. Although this
uses extra memory, maps with zero-sized key types that have sensible
implementations of the ordering traits can only contain a single
key-value pair (and therefore only a single leaf node), and maps with
key and value types that are both zero-sized have few uses, if any.

Furthermore, this is a temporary fix that will likely be unnecessary
once the `BTreeMap` implementation is rewritten to use parent pointers.

Closes #28493.
Diffstat (limited to 'src/libsyntax/errors')
0 files changed, 0 insertions, 0 deletions