summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
diff options
context:
space:
mode:
authorTamas Berghammer <tberghammer@google.com>2015-08-25 11:45:46 +0000
committerTamas Berghammer <tberghammer@google.com>2015-08-25 11:45:46 +0000
commitb7c64651e4973d080635889aefa01abc3a5ef478 (patch)
tree1b4b1e7017a8b349c2f7122f7fbb4c99fe0d4967 /lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
parentb62c5bc64dee3642884c31b8208c07a6f74b81fd (diff)
downloadbcm5719-llvm-b7c64651e4973d080635889aefa01abc3a5ef478.tar.gz
bcm5719-llvm-b7c64651e4973d080635889aefa01abc3a5ef478.zip
Fix buffer overflow for fixed_form_sizes
The array is indexed by the value in the DW_FORM filed what can be bigger then the size of the array. This CL add bound checking to avoid buffer overflows Differential revision: http://reviews.llvm.org/D12239 llvm-svn: 245930
Diffstat (limited to 'lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp')
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
index 5e86337d8e1..a3f06d7c11b 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
@@ -176,7 +176,8 @@ DWARFCompileUnit::ExtractDIEsIfNeeded (bool cu_die_only)
die_index_stack.reserve(32);
die_index_stack.push_back(0);
bool prev_die_had_children = false;
- const uint8_t *fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize (GetAddressByteSize(), m_is_dwarf64);
+ DWARFFormValue::FixedFormSizes fixed_form_sizes =
+ DWARFFormValue::GetFixedFormSizesForAddressSize (GetAddressByteSize(), m_is_dwarf64);
while (offset < next_cu_offset &&
die.FastExtract (debug_info_data, this, fixed_form_sizes, &offset))
{
@@ -661,7 +662,8 @@ DWARFCompileUnit::Index (const uint32_t cu_idx,
{
const DWARFDataExtractor* debug_str = &m_dwarf2Data->get_debug_str_data();
- const uint8_t *fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize (GetAddressByteSize(), m_is_dwarf64);
+ DWARFFormValue::FixedFormSizes fixed_form_sizes =
+ DWARFFormValue::GetFixedFormSizesForAddressSize (GetAddressByteSize(), m_is_dwarf64);
Log *log (LogChannelDWARF::GetLogIfAll (DWARF_LOG_LOOKUPS));
OpenPOWER on IntegriCloud