Changeset: 0882e7d5d037 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/0882e7d5d037
Modified Files:
monetdb5/modules/mal/txtsim.c
Branch: Dec2023
Log Message:
some more protection against overflow in ints
diffs (23 lines):
diff --git a/monetdb5/modules/mal/txtsim.c b/monetdb5/modules/mal/txtsim.c
--- a/monetdb5/modules/mal/txtsim.c
+++ b/monetdb5/modules/mal/txtsim.c
@@ -65,8 +65,8 @@ dameraulevenshtein(int *res, str *S, str
char *s = *S;
char *t = *T;
int *d; /* pointer to matrix */
- int n; /* length of s */
- int m; /* length of t */
+ lng n; /* length of s */
+ lng m; /* length of t */
int i; /* iterates through s */
int j; /* iterates through t */
char s_i; /* ith character of s */
@@ -96,7 +96,7 @@ dameraulevenshtein(int *res, str *S, str
return MAL_SUCCEED;
}
sz = (n + 1) * (m + 1) * sizeof(int);
- if (sz > (1<<30))
+ if (sz > (LL_CONSTANT(1)<<28))
throw(MAL, "dameraulevenshtein", SQLSTATE(HY013)
MAL_MALLOC_FAIL);
d = (int *) GDKmalloc((size_t)sz);
if (d == NULL)
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]