summaryrefslogtreecommitdiff
path: root/storage/connect/valblk.cpp
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2017-03-06 17:23:56 +0100
committerOlivier Bertrand <bertrandop@gmail.com>2017-03-06 17:23:56 +0100
commit92d283c026b66ae772b4343f366f0da6321daa28 (patch)
treeb879196bfea2c540048f26c6c1b4b7bd1c5ac521 /storage/connect/valblk.cpp
parentb2956b2ab437403f413b65f6fdaaf706847bc833 (diff)
downloadmariadb-git-92d283c026b66ae772b4343f366f0da6321daa28.tar.gz
Fix MDEV-12142 crash when creating CSV table
Was an unprepared longjmp (now throw) Also fix a wrong calculation of To_Line sometimes causing a crash because of buffer overflow. modified: storage/connect/tabdos.cpp Fix a wrong setting of USER for JDBC tables in connect_assisted_discovery. Update jdbc_new.test after that fix, which changed errors. modified: storage/connect/ha_connect.cc modified: storage/connect/mysql-test/connect/r/jdbc_new.result modified: storage/connect/mysql-test/connect/t/jdbc_new.test Make using try/catch/throw the default option modified: storage/connect/CMakeLists.txt Typo modified: storage/connect/xindex.cpp Replace setjmp-longjmp's by try_catch-throw modified: storage/connect/CMakeLists.txt modified: storage/connect/array.cpp modified: storage/connect/blkfil.cpp modified: storage/connect/colblk.cpp modified: storage/connect/connect.cc modified: storage/connect/filamtxt.cpp modified: storage/connect/filamvct.cpp modified: storage/connect/filter.cpp modified: storage/connect/global.h modified: storage/connect/ha_connect.cc modified: storage/connect/jdbconn.cpp modified: storage/connect/json.cpp modified: storage/connect/jsonudf.cpp modified: storage/connect/odbconn.cpp modified: storage/connect/osutil.c modified: storage/connect/plgdbutl.cpp deleted: storage/connect/plugutil.c added: storage/connect/plugutil.cpp modified: storage/connect/tabdos.cpp modified: storage/connect/tabfix.cpp modified: storage/connect/tabfmt.cpp modified: storage/connect/tabjdbc.cpp modified: storage/connect/tabjdbc.h modified: storage/connect/tabjson.cpp modified: storage/connect/tabmul.cpp modified: storage/connect/tabmul.h modified: storage/connect/tabmysql.cpp modified: storage/connect/tabodbc.cpp modified: storage/connect/tabodbc.h modified: storage/connect/tabpivot.cpp modified: storage/connect/tabsys.cpp modified: storage/connect/tabvct.cpp modified: storage/connect/tabvir.cpp modified: storage/connect/tabxml.cpp modified: storage/connect/valblk.cpp modified: storage/connect/value.cpp modified: storage/connect/xindex.cpp modified: storage/connect/xobject.cpp
Diffstat (limited to 'storage/connect/valblk.cpp')
-rw-r--r--storage/connect/valblk.cpp76
1 files changed, 56 insertions, 20 deletions
diff --git a/storage/connect/valblk.cpp b/storage/connect/valblk.cpp
index 5fefcba5856..4331962e0ad 100644
--- a/storage/connect/valblk.cpp
+++ b/storage/connect/valblk.cpp
@@ -1,7 +1,7 @@
/************ Valblk C++ Functions Source Code File (.CPP) *************/
-/* Name: VALBLK.CPP Version 2.1 */
+/* Name: VALBLK.CPP Version 2.2 */
/* */
-/* (C) Copyright to the author Olivier BERTRAND 2005-2015 */
+/* (C) Copyright to the author Olivier BERTRAND 2005-2017 */
/* */
/* This file contains the VALBLK and derived classes functions. */
/* Second family is VALBLK, representing simple suballocated arrays */
@@ -138,8 +138,12 @@ PSZ VALBLK::GetCharValue(int)
assert(g);
sprintf(g->Message, MSG(NO_CHAR_FROM), Type);
- longjmp(g->jumper[g->jump_level], Type);
- return NULL;
+#if defined(USE_TRY)
+ throw Type;
+#else // !USE_TRY
+ longjmp(g->jumper[g->jump_level], Type);
+#endif // !USE_TRY
+ return NULL;
} // end of GetCharValue
/***********************************************************************/
@@ -206,8 +210,12 @@ void VALBLK::ChkIndx(int n)
if (n < 0 || n >= Nval) {
PGLOBAL& g = Global;
strcpy(g->Message, MSG(BAD_VALBLK_INDX));
- longjmp(g->jumper[g->jump_level], Type);
- } // endif n
+#if defined(USE_TRY)
+ throw Type;
+#else // !USE_TRY
+ longjmp(g->jumper[g->jump_level], Type);
+#endif // !USE_TRY
+ } // endif n
} // end of ChkIndx
@@ -216,8 +224,12 @@ void VALBLK::ChkTyp(PVAL v)
if (Check && (Type != v->GetType() || Unsigned != v->IsUnsigned())) {
PGLOBAL& g = Global;
strcpy(g->Message, MSG(VALTYPE_NOMATCH));
- longjmp(g->jumper[g->jump_level], Type);
- } // endif Type
+#if defined(USE_TRY)
+ throw Type;
+#else // !USE_TRY
+ longjmp(g->jumper[g->jump_level], Type);
+#endif // !USE_TRY
+ } // endif Type
} // end of ChkTyp
@@ -226,8 +238,12 @@ void VALBLK::ChkTyp(PVBLK vb)
if (Check && (Type != vb->GetType() || Unsigned != vb->IsUnsigned())) {
PGLOBAL& g = Global;
strcpy(g->Message, MSG(VALTYPE_NOMATCH));
- longjmp(g->jumper[g->jump_level], Type);
- } // endif Type
+#if defined(USE_TRY)
+ throw Type;
+#else // !USE_TRY
+ longjmp(g->jumper[g->jump_level], Type);
+#endif // !USE_TRY
+ } // endif Type
} // end of ChkTyp
@@ -342,8 +358,12 @@ void TYPBLK<TYPE>::SetValue(PSZ p, int n)
if (Check) {
PGLOBAL& g = Global;
strcpy(g->Message, MSG(BAD_SET_STRING));
- longjmp(g->jumper[g->jump_level], Type);
- } // endif Check
+#if defined(USE_TRY)
+ throw Type;
+#else // !USE_TRY
+ longjmp(g->jumper[g->jump_level], Type);
+#endif // !USE_TRY
+ } // endif Check
bool minus;
ulonglong maxval = MaxVal();
@@ -392,8 +412,12 @@ void TYPBLK<double>::SetValue(PSZ p, int n)
if (Check) {
PGLOBAL& g = Global;
strcpy(g->Message, MSG(BAD_SET_STRING));
- longjmp(g->jumper[g->jump_level], Type);
- } // endif Check
+#if defined(USE_TRY)
+ throw Type;
+#else // !USE_TRY
+ longjmp(g->jumper[g->jump_level], Type);
+#endif // !USE_TRY
+ } // endif Check
Typp[n] = atof(p);
SetNull(n, false);
@@ -795,8 +819,12 @@ void CHRBLK::SetValue(char *sp, uint len, int n)
if (Check && (signed)len > Long) {
PGLOBAL& g = Global;
strcpy(g->Message, MSG(SET_STR_TRUNC));
- longjmp(g->jumper[g->jump_level], Type);
- } // endif Check
+#if defined(USE_TRY)
+ throw Type;
+#else // !USE_TRY
+ longjmp(g->jumper[g->jump_level], Type);
+#endif // !USE_TRY
+ } // endif Check
#endif // _DEBUG
if (sp)
@@ -823,8 +851,12 @@ void CHRBLK::SetValue(PVBLK pv, int n1, int n2)
if (Type != pv->GetType() || Long != ((CHRBLK*)pv)->Long) {
PGLOBAL& g = Global;
strcpy(g->Message, MSG(BLKTYPLEN_MISM));
- longjmp(g->jumper[g->jump_level], Type);
- } // endif Type
+#if defined(USE_TRY)
+ throw Type;
+#else // !USE_TRY
+ longjmp(g->jumper[g->jump_level], Type);
+#endif // !USE_TRY
+ } // endif Type
if (!(b = pv->IsNull(n2)))
memcpy(Chrp + n1 * Long, ((CHRBLK*)pv)->Chrp + n2 * Long, Long);
@@ -874,8 +906,12 @@ void CHRBLK::SetValues(PVBLK pv, int k, int n)
if (Type != pv->GetType() || Long != ((CHRBLK*)pv)->Long) {
PGLOBAL& g = Global;
strcpy(g->Message, MSG(BLKTYPLEN_MISM));
- longjmp(g->jumper[g->jump_level], Type);
- } // endif Type
+#if defined(USE_TRY)
+ throw Type;
+#else // !USE_TRY
+ longjmp(g->jumper[g->jump_level], Type);
+#endif // !USE_TRY
+ } // endif Type
#endif // _DEBUG
char *p = ((CHRBLK*)pv)->Chrp;