Hi!
I understand that the question is less than ideal, and I'm sorry for that.
I'm trying to debug a very strange bug in Firebird built into LibreOffice (embedded DB functionality). A specific ODB (a package that contains a FB database) crashes executing a query 'SELECT DISTINCT "ТипВорот" FROM "ВОРОТА"', with the field used in the query is a Varchar; and I was able to debug up to the point at Sort::diddleKey, where for some reason the following line:
const USHORT fill = n - sizeof(USHORT) - vlen;
has n less than (sizeof(USHORT) + vlen), resulting in a large resulting value, which then in the following line:
memset(fill_pos, fill_char, fill);
results in access violation.
Additionally, the wrong value of vlen seems to be set in the same function at
((vary*) p)->vary_length = *((USHORT*) (record + key->skd_vary_offset));
but I fail to follow the logic why that happens.
I tried to extract the database, and use isql tool to perform the same query interactively - and that works fine. I also have cloned and built FB from its github repo in DEBUG mode, in the hope that it could allow me to catch the condition in the debugger - bit in it, the problem is never met.
I actually suspect that our integration might do something wrong initializing the engine, but I am very inexperienced in FB development, and can't easily see what's wrong there.
LibreOffice project uses FB 3. I am debugging on Windows using VS. I would be glad for any advise where to look/put a breakpoint/etc to nail down the project. Possibly my poor description could still make some dev here to tell "Of course, it's Foo; how could he not know that basic thing!" - that would be super-cool :)
Thank you for any advise, and thanks for the great product!
--
Best regards,
Mike Kaganski