diff options
Diffstat (limited to 'geography/geos/patches/patch-capi_geos__ts__c.cpp')
-rw-r--r-- | geography/geos/patches/patch-capi_geos__ts__c.cpp | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/geography/geos/patches/patch-capi_geos__ts__c.cpp b/geography/geos/patches/patch-capi_geos__ts__c.cpp index 56d52dac949..884d30136d9 100644 --- a/geography/geos/patches/patch-capi_geos__ts__c.cpp +++ b/geography/geos/patches/patch-capi_geos__ts__c.cpp @@ -1,45 +1,46 @@ -$NetBSD: patch-capi_geos__ts__c.cpp,v 1.2 2018/09/11 16:13:29 gdt Exp $ +$NetBSD: patch-capi_geos__ts__c.cpp,v 1.3 2020/03/11 12:52:07 gdt Exp $ -\todo Document this patch. It appears to be that passing non-POD types -to variadic functions is UB. +Passing non-POD types like std::string to variadic functions is UB. +To avoid this, change functions to take const char * rather than +std::string. + +\todo File a bug upstream -\todo File a bug upstream, if appropriate. - ---- capi/geos_ts_c.cpp.orig 2015-09-08 16:31:02.000000000 +0000 +--- capi/geos_ts_c.cpp.orig 2020-03-10 17:19:40.000000000 +0000 +++ capi/geos_ts_c.cpp -@@ -214,7 +214,7 @@ typedef struct GEOSContextHandle_HS +@@ -233,7 +233,7 @@ typedef struct GEOSContextHandle_HS { } void - NOTICE_MESSAGE(string fmt, ...) + NOTICE_MESSAGE(const char *fmt, ...) { - if (NULL == noticeMessageOld && NULL == noticeMessageNew) { - return; -@@ -222,7 +222,7 @@ typedef struct GEOSContextHandle_HS + if(NULL == noticeMessageOld && NULL == noticeMessageNew) { + return; +@@ -241,7 +241,7 @@ typedef struct GEOSContextHandle_HS { - va_list args; - va_start(args, fmt); -- int result = vsnprintf(msgBuffer, sizeof(msgBuffer) - 1, fmt.c_str(), args); -+ int result = vsnprintf(msgBuffer, sizeof(msgBuffer) - 1, fmt, args); - va_end(args); + va_list args; + va_start(args, fmt); +- int result = vsnprintf(msgBuffer, sizeof(msgBuffer) - 1, fmt.c_str(), args); ++ int result = vsnprintf(msgBuffer, sizeof(msgBuffer) - 1, fmt, args); + va_end(args); - if (result > 0) { -@@ -235,7 +235,7 @@ typedef struct GEOSContextHandle_HS + if(result > 0) { +@@ -255,7 +255,7 @@ typedef struct GEOSContextHandle_HS { } void - ERROR_MESSAGE(string fmt, ...) + ERROR_MESSAGE(const char *fmt, ...) { - if (NULL == errorMessageOld && NULL == errorMessageNew) { - return; -@@ -243,7 +243,7 @@ typedef struct GEOSContextHandle_HS + if(NULL == errorMessageOld && NULL == errorMessageNew) { + return; +@@ -263,7 +263,7 @@ typedef struct GEOSContextHandle_HS { - va_list args; - va_start(args, fmt); -- int result = vsnprintf(msgBuffer, sizeof(msgBuffer) - 1, fmt.c_str(), args); -+ int result = vsnprintf(msgBuffer, sizeof(msgBuffer) - 1, fmt, args); - va_end(args); + va_list args; + va_start(args, fmt); +- int result = vsnprintf(msgBuffer, sizeof(msgBuffer) - 1, fmt.c_str(), args); ++ int result = vsnprintf(msgBuffer, sizeof(msgBuffer) - 1, fmt, args); + va_end(args); - if (result > 0) { + if(result > 0) { |