This is an automated email from the ASF dual-hosted git repository.

lidavidm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-adbc.git


The following commit(s) were added to refs/heads/main by this push:
     new 2e2eb976 fix(c/driver/postgresql): Fix overflow in statement.cc (#1072)
2e2eb976 is described below

commit 2e2eb976b1d57132f7db466e369ea0a96df2e5d5
Author: William Ayd <[email protected]>
AuthorDate: Fri Sep 15 10:38:06 2023 -0400

    fix(c/driver/postgresql): Fix overflow in statement.cc (#1072)
    
    Not sure why CI didn't flag these but seeing locally when running tests
---
 c/driver/postgresql/statement.cc | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/c/driver/postgresql/statement.cc b/c/driver/postgresql/statement.cc
index 22e394c6..3910378a 100644
--- a/c/driver/postgresql/statement.cc
+++ b/c/driver/postgresql/statement.cc
@@ -433,14 +433,17 @@ struct BindStream {
 
               switch (unit) {
                 case NANOARROW_TIME_UNIT_SECOND:
-                  overflow_safe =
-                      val <= kMaxSafeSecondsToMicros && val >= 
kMinSafeSecondsToMicros;
-                  val *= 1000000;
+                  if ((overflow_safe = val <= kMaxSafeSecondsToMicros &&
+                                       val >= kMinSafeSecondsToMicros)) {
+                    val *= 1000000;
+                  }
+
                   break;
                 case NANOARROW_TIME_UNIT_MILLI:
-                  overflow_safe =
-                      val <= kMaxSafeMillisToMicros && val >= 
kMinSafeMillisToMicros;
-                  val *= 1000;
+                  if ((overflow_safe = val <= kMaxSafeMillisToMicros &&
+                                       val >= kMinSafeMillisToMicros)) {
+                    val *= 1000;
+                  }
                   break;
                 case NANOARROW_TIME_UNIT_MICRO:
                   break;

Reply via email to