Menu

#6 OCI_CollGetSize segfault if defined OCI_CHARSET_UNICODE.

closed
nobody
None
5
2012-09-26
2009-12-11
Dmitry
No

Hi.

If in project defined directive OCI_CHARSET_UNICODE and when calling OCI_CollGetSize method, application segmentation fault.

if defined OCI_CHARSET_ANSI all works correctly.

See bug 2859690

int main(int argc, char argv[]){
if (!OCI_Initialize(NULL, NULL, OCI_ENV_DEFAULT | OCI_ENV_CONTEXT))
return EXIT_FAILURE;
OCI_Connection
cn = OCI_ConnectionCreate(MT("//localhost/XE"), MT("dima"), MT("dima"), OCI_SESSION_DEFAULT);
OCI_Statement st = OCI_StatementCreate(cn);
OCI_SetFetchMode(st, OCI_SFM_SCROLLABLE);
OCI_ExecuteStmt(st,MT("SELECT gid, geometry FROM test_insert"));
OCI_Resultset
rs = OCI_GetResultset(st);
if (OCI_FetchFirst(rs)) {
OCI_Object obj = OCI_GetObject(rs, 2);
if (OCI_ObjectGetInt(obj,MT("SDO_GTYPE")) == 4) {
OCI_Coll
coll = OCI_ObjectGetColl(obj,MT("SDO_ELEM_INFO"));
std::cout << "count=" << OCI_CollGetSize(coll) << std::endl;
/
If defined macro OCI_CHARSET_UNICODE - Segmentation fault
If defined OCI_CHARSET_ANSI output text:
count=3
/
}
}
OCI_Cleanup();
}

--
Best regards, Dmitry.

P.S.
Version 3.5.0 from SVN

Discussion

  • Dmitry

    Dmitry - 2009-12-11

    server:
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
    and
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod

     
  • Vincent Rogier

    Vincent Rogier - 2009-12-11

    Hi,

    As said in OCILIB documentation, page <Oracle Named="" Types="" (Oracle="" Objects)="">, this is a current bug in OCI :

    "Warning:
    There is a known bug in Oracle OCI when setting an object attribute if OCI is initialized in Unicode mode (UTF16). This bug has been marked as fixed for in the current Oracle 12g development status. So, DO NOT try to set Objects attributes in Unicode builds with versions <= 11g because OCI will overwrite internal buffers and later calls to object attributes handles will lead to an OCI crash."

    FYI, if you have acces to metalink, it's the bug #6885036 (in reponse to a SR i've opened a while ago)

    regards,

    Vincent

     
  • Vincent Rogier

    Vincent Rogier - 2009-12-11

    I've just check the bug page on metalink and it shown as fixed in 11gR2 :)

     
  • Dmitry

    Dmitry - 2009-12-11

    Thanks for the clarification

     
  • Dmitry

    Dmitry - 2009-12-11

    I close the bug

     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.