Open Krzmbrzl opened 2 months ago
The problem seems to boil down to this:
row
object inside the rowset
seems to be reused across different data fetches (loop iterations)row
object is (seemingly) only initialized when first creating the rowset
object (by binding the contained statement to the row
in rowset
's constructor)move_as
the respective entry inside row
's holders gets into an invalid state. In case of a blob that corresponds to an uninitialized blob object (one where the backend pointer is nullptr
)blob
dereferences the nullptr
backend resulting in the segmentation faultTherefore, the fix for this issue would be to find a way to let the row
object know about invalidated holders, which should cause it to reinitialize them before trying to use them for data binding.
May be we could use shared_ptr
Nah, the get
function cant return a pointer. That'd be inconsistent.
Besides, this wouldn't really solve the underlying problem. If the user moves from the dereferenced pointer, we're back at square one with the row
object being broken.
Originally reported by @avpalienko in https://github.com/SOCI/soci/issues/1141#issuecomment-2057755837
When applying the following patch to the
common-tests.h
file, themove_as
test case will crash due to a segmentation fault:The issue was originally reported to happen with Oracle, but I was also able to reproduce it with SQLite3, indicating that the issue is not backend-specific.