Changeset: 2976216fcef0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/2976216fcef0
Modified Files:
sql/backends/monet5/generator/generator.c
Branch: Dec2025
Log Message:
Add a cast and do an overflow check.
diffs (26 lines):
diff --git a/sql/backends/monet5/generator/generator.c
b/sql/backends/monet5/generator/generator.c
--- a/sql/backends/monet5/generator/generator.c
+++ b/sql/backends/monet5/generator/generator.c
@@ -280,6 +280,8 @@ VLTgenerator_table_(BAT **result, Client
throw(MAL, "generator.table",
SQLSTATE(42000) "Illegal generator
range");
s /= 24*60*60*1000;
+ if (s > (lng) GDK_int_max)
+ s = (lng) GDK_int_max;
/* check if s is really in nr of days or usecs */
n = (BUN) (date_diff(l, f) / s) + 1; /* n maybe too
large now */
bn = COLnew(0, TYPE_date, n + 1, TRANSIENT);
@@ -287,11 +289,11 @@ VLTgenerator_table_(BAT **result, Client
throw(MAL, "generator.table", SQLSTATE(HY013)
MAL_MALLOC_FAIL);
v = (date *) Tloc(bn, 0);
if (s < 0) {
- for (; !is_date_nil(f) && f > l; f =
date_add_day(f, s)) {
+ for (; !is_date_nil(f) && f > l; f =
date_add_day(f, (int) s)) {
*v++ = f;
}
} else {
- for (; !is_date_nil(f) && f < l; f =
date_add_day(f, s)) {
+ for (; !is_date_nil(f) && f < l; f =
date_add_day(f, (int) s)) {
*v++ = f;
}
}
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]