FreeTDS / freetds

Official FreeTDS repository
http://www.freetds.org/
GNU General Public License v2.0
455 stars 155 forks source link

odbc_util.c:214: odbc_wide2utf: Assertion `p+1-out <= o_len' failed #531

Open kothapraveen opened 4 months ago

kothapraveen commented 4 months ago

Hi @brianb

Currently am working with below environment

unixODBC- 2.3.11 gcc540 RHEL7 64 FreeTDS 1.3

my source code(interacting DB with sql statements) is working fine for windows but in linux am facing below assertion

odbc_util.c:214: odbc_wide2utf: Assertion `p+1-out <= o_len' failed

can you help me to resolve the issue

freddy77 commented 4 months ago

Which charset are you using? Can you send a TDSDUMP output ?

kothapraveen commented 4 months ago

Hi @freddy77

please find the below details

Error: retVal.size() was not equal to binLongVarCharMaxStr.size(); retVal.size()-->1; binLongVarCharMaxStr.size()-->5461 odbc_util.c:214: odbc_wide2utf: Assertion `p+1-out <= o_len' failed. make: * [Makefile:293: test] Aborted (core dumped**)

Suspecting Method: SQLPrepareW()

currently we are using char

    if defined (__linux)
        //nchar_char = 0xc290;
        nchar_char = 0xC290;
        nchar_hex = L"C290";
    #else
        nchar_char = 0x90c2;
    nchar_hex = L"90c2";

ConvertBetweenCodePages: const char dstCodePage [] = "UCS-2", // Destination Code Page. srcCodePage [] = "WCHAR_T"; // Source Code Page

freetds log:

token.c:2100:tds_process_end: more_results = 0 was_cancelled = 0 error = 0 done_count_valid = 0 token.c:2119: rows_affected = 0 token.c:2122:tds_process_end() state set to TDS_IDLE util.c:179:Changed query state from READING to IDLE util.c:83:logic error: cannot change query state from IDLE to PENDING util.c:179:Changed query state from IDLE to IDLE odbc.c:3766:odbc_process_tokens: tds_process_tokens returned 0 odbc.c:3767: result_type=4053, TDS_DONE_COUNT=0, TDS_DONE_ERROR=0 odbc.c:3812:odbc_process_tokens: processed TDS_DONEPROC_RESULT token.c:555:tds_process_tokens(0x2030fa0, 0x7ffd199b4d58, 0x7ffd199b4d5c, 0x26914) token.c:558:tds_process_tokens() state is COMPLETED odbc.c:3766:odbc_process_tokens: tds_process_tokens returned 1 odbc.c:3767: result_type=4052, TDS_DONE_COUNT=0, TDS_DONE_ERROR=0 odbc.c:3588:_SQLExecute: odbc_process_tokens returned result_type 4046 odbc.c:3751:SQLExecute returns SQL_SUCCESS odbc.c:4680:SQLNumResultCols(0x20bdb30, 0x7ffd199b500e) odbc.c:1918:SQLAllocStmt(0x202eb80, 0x20d9d20) odbc.c:1810:_SQLAllocStmt(0x202eb80, 0x20d9d20) odbc.c:4648:SQLGetStmtAttr(0x20e4150, 10010, 0x7ffd199b8510, 8, (nil)) odbc.c:4648:SQLGetStmtAttr(0x20e4150, 10011, 0x7ffd199b8510, 8, (nil)) odbc.c:4648:SQLGetStmtAttr(0x20e4150, 10012, 0x7ffd199b8510, 8, (nil)) odbc.c:4648:SQLGetStmtAttr(0x20e4150, 10013, 0x7ffd199b8510, 8, (nil)) odbc_export.h:837:SQLPrepareW(0x20e4150, insert character_datatypes_intl(nvarcharmax, description) values (N'슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐>슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐>슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐슐>슐슐슐슐슐슐슐슐슐슐슐슐, 11164) 4575,1 Bot