mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-15 07:16:13 -04:00
Fix heap-use-after-free when writing section index
When writing the section index block, an additional entry was added to the index, potentially reallocating the vector containing the index. However, we previously took the address of the vector data in order to write the index, so that address is now invalid. Fix is by not adding the extra entry to the index.
This commit is contained in:
parent
59b87cdd9f
commit
bf2064f650
@ -383,7 +383,9 @@ void filesystem_writer_<LoggerPolicy>::write(folly::ByteRange range) {
|
||||
|
||||
template <typename LoggerPolicy>
|
||||
void filesystem_writer_<LoggerPolicy>::write(fsblock const& fsb) {
|
||||
push_section_index(fsb.type());
|
||||
if (fsb.type() != section_type::SECTION_INDEX) {
|
||||
push_section_index(fsb.type());
|
||||
}
|
||||
|
||||
write(fsb.header());
|
||||
write(fsb.data());
|
||||
|
Loading…
x
Reference in New Issue
Block a user