Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP2:GA
mariadb-connector-odbc
libreoffice_fixes.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File libreoffice_fixes.patch of Package mariadb-connector-odbc
Fix crashes with OpenOffice Upstream Bug: https://jira.mariadb.org/browse/ODBC-123 https://bugzilla.novell.com/show_bug.cgi?id=938195 commit a1e8995d0f8132663ed98a1b6333f2d53b3fe885 Author: Lawrin Novitsky <lawrin.novitsky@mariadb.com> Date: Wed Dec 27 21:46:48 2017 +0100 [ODBC-123] Fix and testcase. LibreOffice sets SQL_ATTR_USE_BOOKMARKS attribute, but does not actually use bookmarks. The connector was not ready for that, and would throw wrongly error, and then crash. Fixed a number of compilation warnings. commit cfb8e530fdabcd17b84a4609a1423fb51ffcea5a Author: Lawrin <lawrin@deb9.lawrin.office> Date: Fri Jan 12 17:50:40 2018 -0500 Addition to the fix of ODBC-123 and the testcase for that problem - for SQL_CATALOG_LOCATION info type the connector incorrectly wrote to the buffer SQLUINTEGER, while it has to be SQLUSMALLINT diff --git a/ma_bulk.c b/ma_bulk.c index 4008f55..f45a4bd 100644 --- a/ma_bulk.c +++ b/ma_bulk.c @@ -170,7 +170,7 @@ SQLRETURN MADB_SetBulkOperLengthArr(MADB_Stmt *Stmt, MADB_DescRecord *CRec, SQLL if (VariableLengthMadbType) { - MaBind->length[row]= MADB_CalculateLength(Stmt, OctetLengthPtr != NULL ? &OctetLengthPtr[row] : NULL, CRec, DataPtr); + MaBind->length[row]= (unsigned long)MADB_CalculateLength(Stmt, OctetLengthPtr != NULL ? &OctetLengthPtr[row] : NULL, CRec, DataPtr); } } @@ -322,7 +322,7 @@ SQLRETURN MADB_ExecuteBulk(MADB_Stmt *Stmt, unsigned int ParamOffset) { if (Stmt->Apd->Header.ArrayStatusPtr[row] == SQL_PARAM_IGNORE) { - MADB_SetIndicatorValue(Stmt, &Stmt->params[IndIdx], row, SQL_PARAM_IGNORE); + MADB_SetIndicatorValue(Stmt, &Stmt->params[IndIdx], (unsigned int)row, SQL_PARAM_IGNORE); } } } diff --git a/ma_connection.c b/ma_connection.c index 32be6bf..b18ed6d 100644 --- a/ma_connection.c +++ b/ma_connection.c @@ -1333,7 +1333,7 @@ SQLRETURN MADB_DbcGetInfo(MADB_Dbc *Dbc, SQLUSMALLINT InfoType, SQLPOINTER InfoV { size_t max_packet_size; mariadb_get_infov(Dbc->mariadb, MARIADB_MAX_ALLOWED_PACKET, &max_packet_size); - MADB_SET_NUM_VAL(SQLUINTEGER, InfoValuePtr, max_packet_size, StringLengthPtr); + MADB_SET_NUM_VAL(SQLUINTEGER, InfoValuePtr, (SQLUINTEGER)max_packet_size, StringLengthPtr); } break; case SQL_MAX_TABLE_NAME_LEN: diff --git a/ma_desc.c b/ma_desc.c index a432098..14f1dab 100644 --- a/ma_desc.c +++ b/ma_desc.c @@ -738,7 +738,7 @@ SQLRETURN MADB_DescGetField(SQLHDESC DescriptorHandle, *((SQLPOINTER *)ValuePtr)= (SQLPOINTER)Desc->Header.BindOffsetPtr; break; case SQL_DESC_BIND_TYPE: - *((SQLINTEGER *)ValuePtr)= Desc->Header.BindType; + *((SQLULEN *)ValuePtr)= Desc->Header.BindType; break; case SQL_DESC_COUNT: *(SQLSMALLINT *)ValuePtr= Desc->Header.Count; diff --git a/ma_statement.c b/ma_statement.c index 9b366a6..b1bea8e 100644 --- a/ma_statement.c +++ b/ma_statement.c @@ -459,7 +459,7 @@ SQLRETURN MADB_RegularPrepare(MADB_Stmt *Stmt) { LOCK_MARIADB(Stmt->Connection); MDBUG_C_PRINT(Stmt->Connection, "mysql_stmt_prepare(%0x,%s)", Stmt->stmt, Stmt->StmtString); - if (mysql_stmt_prepare(Stmt->stmt, Stmt->StmtString, strlen(Stmt->StmtString))) + if (mysql_stmt_prepare(Stmt->stmt, Stmt->StmtString, (unsigned long)strlen(Stmt->StmtString))) { /* Need to save error first */ MADB_SetNativeError(&Stmt->Error, SQL_HANDLE_STMT, Stmt->stmt); @@ -998,7 +998,7 @@ SQLRETURN MADB_StmtExecute(MADB_Stmt *Stmt, BOOL ExecDirect) unsigned int ParamOffset= 0; /* for multi statements */ unsigned int Iterations= 1, /* Will use it for STMT_ATTR_ARRAY_SIZE and as indicator if we are deploying MariaDB bulk insert feature */ - MariadbArrSize= MADB_BulkInsertPossible(Stmt) != FALSE ? Stmt->Apd->Header.ArraySize : 0; + MariadbArrSize= MADB_BulkInsertPossible(Stmt) != FALSE ? (unsigned int)Stmt->Apd->Header.ArraySize : 0; SQLULEN j, Start= 0; MDBUG_C_PRINT(Stmt->Connection, "%sMADB_StmtExecute", "\t->"); @@ -1077,7 +1077,7 @@ SQLRETURN MADB_StmtExecute(MADB_Stmt *Stmt, BOOL ExecDirect) { /* Doing just the same thing as we would do in general case */ MADB_CleanBulkOperData(Stmt, ParamOffset); - ErrorCount= Stmt->Apd->Header.ArraySize; + ErrorCount= (unsigned int)Stmt->Apd->Header.ArraySize; MADB_SetStatusArray(Stmt, SQL_PARAM_DIAG_UNAVAILABLE); goto end; } @@ -1087,7 +1087,7 @@ SQLRETURN MADB_StmtExecute(MADB_Stmt *Stmt, BOOL ExecDirect) } /* Suboptimal, but more reliable and simple */ MADB_CleanBulkOperData(Stmt, ParamOffset); - Stmt->ArrayOffset+= Stmt->Apd->Header.ArraySize; + Stmt->ArrayOffset+= (int)Stmt->Apd->Header.ArraySize; if (Stmt->Ipd->Header.RowsProcessedPtr) { *Stmt->Ipd->Header.RowsProcessedPtr= *Stmt->Ipd->Header.RowsProcessedPtr + Stmt->Apd->Header.ArraySize; @@ -1851,7 +1851,7 @@ SQLRETURN MADB_StmtFetch(MADB_Stmt *Stmt) return MADB_SetError(&Stmt->Error, MADB_ERR_24000, NULL, 0); } - if ((Stmt->Options.UseBookmarks == SQL_UB_VARIABLE && Stmt->Options.BookmarkType != SQL_C_VARBOOKMARK) || + if ((Stmt->Options.UseBookmarks == SQL_UB_VARIABLE && Stmt->Options.BookmarkType == SQL_C_BOOKMARK) || (Stmt->Options.UseBookmarks != SQL_UB_VARIABLE && Stmt->Options.BookmarkType == SQL_C_VARBOOKMARK)) { MADB_SetError(&Stmt->Error, MADB_ERR_07006, NULL, 0); @@ -1930,7 +1930,7 @@ SQLRETURN MADB_StmtFetch(MADB_Stmt *Stmt) /************************ Bind! ********************************/ mysql_stmt_bind_result(Stmt->stmt, Stmt->result); - if (Stmt->Options.UseBookmarks) + if (Stmt->Options.UseBookmarks && Stmt->Options.BookmarkPtr != NULL) { /* TODO: Bookmark can be not only "unsigned long*", but also "unsigned char*". Can be determined by examining Stmt->Options.BookmarkType */ long *p= (long *)Stmt->Options.BookmarkPtr; @@ -2059,7 +2059,7 @@ SQLRETURN MADB_StmtGetAttr(MADB_Stmt *Stmt, SQLINTEGER Attribute, SQLPOINTER Val *(SQLPOINTER *)ValuePtr= Stmt->Apd->Header.BindOffsetPtr; break; case SQL_ATTR_PARAM_BIND_TYPE: - *(SQLINTEGER *)ValuePtr= Stmt->Apd->Header.BindType; + *(SQLULEN *)ValuePtr= Stmt->Apd->Header.BindType; break; case SQL_ATTR_PARAM_OPERATION_PTR: *(SQLPOINTER *)ValuePtr= (SQLPOINTER)Stmt->Apd->Header.ArrayStatusPtr; @@ -2084,7 +2084,7 @@ SQLRETURN MADB_StmtGetAttr(MADB_Stmt *Stmt, SQLINTEGER Attribute, SQLPOINTER Val *(SQLPOINTER *)ValuePtr= (SQLPOINTER)Stmt->Ard->Header.BindOffsetPtr; break; case SQL_ATTR_ROW_BIND_TYPE: - *(SQLINTEGER *)ValuePtr= Stmt->Ard->Header.BindType; + *(SQLULEN *)ValuePtr= Stmt->Ard->Header.BindType; break; case SQL_ATTR_ROW_OPERATION_PTR: *(SQLPOINTER *)ValuePtr= (SQLPOINTER)Stmt->Ard->Header.ArrayStatusPtr; @@ -2667,7 +2667,7 @@ SQLRETURN MADB_StmtGetData(SQLHSTMT StatementHandle, if (!Stmt->CharOffset[Offset]) { - Stmt->Lengths[Offset]= CharLength*sizeof(SQLWCHAR); + Stmt->Lengths[Offset]= (unsigned long)(CharLength*sizeof(SQLWCHAR)); } } } @@ -2703,7 +2703,7 @@ SQLRETURN MADB_StmtGetData(SQLHSTMT StatementHandle, if (CharLength >= BufferLength / sizeof(SQLWCHAR)) { /* Calculate new offset and substract 1 byte for null termination */ - Stmt->CharOffset[Offset]+= BufferLength - sizeof(SQLWCHAR); + Stmt->CharOffset[Offset]+= (unsigned long)BufferLength - sizeof(SQLWCHAR); MADB_FREE(ClientValue); return MADB_SetError(&Stmt->Error, MADB_ERR_01004, NULL, 0); diff --git a/ma_typeconv.c b/ma_typeconv.c index 5ffc7cb..818bab1 100644 --- a/ma_typeconv.c +++ b/ma_typeconv.c @@ -578,7 +578,7 @@ SQLRETURN MADB_ConvertC2Sql(MADB_Stmt *Stmt, MADB_DescRecord *CRec, void* DataPt MaBind->buffer_type= 0; MaBind->is_unsigned= 0; - *LengthPtr= Length; + *LengthPtr= (unsigned long)Length; MaBind->buffer_type= MADB_GetMaDBTypeAndLength(CRec->ConciseType, &MaBind->is_unsigned, &MaBind->buffer_length); diff --git a/ma_connection.c b/ma_connection.c index b18ed6d..1b57e2b 100644 --- a/ma_connection.c +++ b/ma_connection.c @@ -887,7 +887,7 @@ SQLRETURN MADB_DbcGetInfo(MADB_Dbc *Dbc, SQLUSMALLINT InfoType, SQLPOINTER InfoV MADB_SET_NUM_VAL(SQLUINTEGER, InfoValuePtr, 0, StringLengthPtr); break; case SQL_CATALOG_LOCATION: - MADB_SET_NUM_VAL(SQLUINTEGER, InfoValuePtr, SQL_CL_START, StringLengthPtr); + MADB_SET_NUM_VAL(SQLUSMALLINT, InfoValuePtr, SQL_CL_START, StringLengthPtr); break; case SQL_CATALOG_NAME: /* Todo: MyODBC Driver has a DSN configuration for diabling catalog usage:
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor