[ 
https://issues.apache.org/jira/browse/IGNITE-16279?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ivan Daschinsky updated IGNITE-16279:
-------------------------------------
    Description: 
{code}
Index: modules/platforms/cpp/odbc/src/utility.cpp
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/modules/platforms/cpp/odbc/src/utility.cpp 
b/modules/platforms/cpp/odbc/src/utility.cpp
--- a/modules/platforms/cpp/odbc/src/utility.cpp        (revision 
e18bbbedfa23f4a4c7bcd1f4c48fa881411e5653)
+++ b/modules/platforms/cpp/odbc/src/utility.cpp        (date 1641994995236)
@@ -136,8 +136,10 @@
             if (!sqlStr || !sqlStrLen)
                 return res;
 
-            if (sqlStrLen == SQL_NTS)
+            if (sqlStrLen == SQL_NTS) {
+                std::cout << "Hopla " << sqlStrC << std::endl;
                 res.assign(sqlStrC);
+            }
             else if (sqlStrLen > 0)
                 res.assign(sqlStrC, sqlStrLen);
 
{code}

Run {{TestStingParamNullLen}} under ASan and get report: 
https://gist.github.com/ivandasch/00fc80c31cb48022eed81a72ff3c4fc6


  was:
{code}
Index: modules/platforms/cpp/odbc/src/utility.cpp
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/modules/platforms/cpp/odbc/src/utility.cpp 
b/modules/platforms/cpp/odbc/src/utility.cpp
--- a/modules/platforms/cpp/odbc/src/utility.cpp        (revision 
e18bbbedfa23f4a4c7bcd1f4c48fa881411e5653)
+++ b/modules/platforms/cpp/odbc/src/utility.cpp        (date 1641994995236)
@@ -136,8 +136,10 @@
             if (!sqlStr || !sqlStrLen)
                 return res;
 
-            if (sqlStrLen == SQL_NTS)
+            if (sqlStrLen == SQL_NTS) {
+                std::cout << "Hopla " << sqlStrC << std::endl;
                 res.assign(sqlStrC);
+            }
             else if (sqlStrLen > 0)
                 res.assign(sqlStrC, sqlStrLen);
 
{code}

Run {{TestStingParamNullLen}} under ASan and get report:



> CPP: ODBC String without with fixed length is treated as SQL_NTS, causes heap 
> buffer overflow
> ---------------------------------------------------------------------------------------------
>
>                 Key: IGNITE-16279
>                 URL: https://issues.apache.org/jira/browse/IGNITE-16279
>             Project: Ignite
>          Issue Type: Bug
>            Reporter: Ivan Daschinsky
>            Priority: Major
>
> {code}
> Index: modules/platforms/cpp/odbc/src/utility.cpp
> IDEA additional info:
> Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
> <+>UTF-8
> ===================================================================
> diff --git a/modules/platforms/cpp/odbc/src/utility.cpp 
> b/modules/platforms/cpp/odbc/src/utility.cpp
> --- a/modules/platforms/cpp/odbc/src/utility.cpp      (revision 
> e18bbbedfa23f4a4c7bcd1f4c48fa881411e5653)
> +++ b/modules/platforms/cpp/odbc/src/utility.cpp      (date 1641994995236)
> @@ -136,8 +136,10 @@
>              if (!sqlStr || !sqlStrLen)
>                  return res;
>  
> -            if (sqlStrLen == SQL_NTS)
> +            if (sqlStrLen == SQL_NTS) {
> +                std::cout << "Hopla " << sqlStrC << std::endl;
>                  res.assign(sqlStrC);
> +            }
>              else if (sqlStrLen > 0)
>                  res.assign(sqlStrC, sqlStrLen);
>  
> {code}
> Run {{TestStingParamNullLen}} under ASan and get report: 
> https://gist.github.com/ivandasch/00fc80c31cb48022eed81a72ff3c4fc6



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to