augusto2112 wrote: > I worry a bit about the fact that in the host case, GetValueAsData is going > to end up calling: > > ``` > memcpy(dst, reinterpret_cast<uint8_t *>(address), byte_size); > ``` > > where address is the host data buffer and byte_size is the size of the new > dynamic type. But in the case where the Value has data in the m_data_buffer, > address points to a buffer. The code makes sure that the destination buffer > (pointed to by dst) is big enough to fit byte_size, but I don't see the > guarantee that the original contents are not smaller than the new dynamic > type byte size. If we get that wrong, then we'll crash here or worse sample > lldb internal memory and present that to the user as a value. How do you know > that can't happen?
I implemented that check inside `GetDynamicTypeAndAddress`. If the buffer is not big enough that function will set address_type as invalid. I think that's the logical place to implement this check, since finding the dynamic type and address is its whole responsibility. https://github.com/llvm/llvm-project/pull/125143 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits