| Summary: | Embedded firebird extends size of CHAR() data field beyond set boundaries and invokes error message | ||
|---|---|---|---|
| Product: | LibreOffice | Reporter: | johnny bugs <johnnybugs> |
| Component: | Base | Assignee: | Not Assigned <libreoffice-bugs> |
| Status: | NEW --- | ||
| Severity: | normal | CC: | johnnybugs, lo_bugs, robert, robert |
| Priority: | medium | ||
| Version: | 6.1.2.1 release | ||
| Hardware: | All | ||
| OS: | All | ||
| URL: | https://github.com/FirebirdSQL/firebird/issues/5854 | ||
| See Also: |
https://bugs.documentfoundation.org/show_bug.cgi?id=106866 https://bugs.documentfoundation.org/show_bug.cgi?id=108082 https://bugs.documentfoundation.org/show_bug.cgi?id=133769 https://bugs.documentfoundation.org/show_bug.cgi?id=120640 |
||
| Whiteboard: | |||
| Crash report or crash signature: | Regression By: | ||
| Bug Depends on: | |||
| Bug Blocks: | 51780 | ||
|
Description
johnny bugs
2022-03-10 09:56:30 UTC
Have tested this with LO 7.3.1.2 and LO 7.2.5.2 on OpenSUSE 15.3 64bit rpm Linux. Spaces have been added because it is a CHAR()-field with defined length. But the length, which is currently added by spaces, will be the wrong length. Looks like a bug with UTF8. Example: To a CHAR(10) field with 10 characters will be added 30 spaces. *** Bug 120640 has been marked as a duplicate of this bug. *** This is wontfix in the firebird bug tracker. The devs there don't consider it to be a bug - the function is working as designed as it is related to the character encoding, so padding occurs according to the number of bytes in which any given character is written. I thought it would be enough to set the UTF8 character set to the connection string. Apparently, this is already the case in Connection::construct [1]. I tried to just divide the sqllen by 4 (UTF8 ) in firebird::mallocSQLVAR [2] but it does not work because system queries sometimes return not a multiple of 4. Maybe the tables and columns were created a different character set. [1]https://opengrok.libreoffice.org/xref/core/connectivity/source/drivers/firebird/Connection.cxx?r=840b4eb2#222 [2]https://opengrok.libreoffice.org/xref/core/connectivity/source/drivers/firebird/Util.cxx?r=3a88b513#296 CHAR_LENGTH() will give the expected value for type CHAR. It will be the same value as defined in the table. But the field will be filled with spaces like it would have if using "normal ASCII". So a field defined for length 3 has 3 defined characters and 9 spaces. There will appear an error if I try to input 4 characters in such a field: firebird_sdbc error: *Dynamic SQL Error *SQL error code = -303 *arithmetic exception, numeric overflow, or string truncation *string right truncation *expected length 3, actual 12 So it counts the right length together with the spaces. But if I delete the just added (4.) character it will save the content. |