From b6a0d2b12b774ac5efe2da345f4c4cc4d8a9c79d Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Sun, 11 Jun 2023 12:34:24 -0700 Subject: [PATCH] Check for empty string like float4in [skip ci] --- src/vector.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/vector.c b/src/vector.c index 2bc0db0..85acd23 100644 --- a/src/vector.c +++ b/src/vector.c @@ -189,6 +189,12 @@ vector_in(PG_FUNCTION_ARGS) while (vector_isspace(*pt)) pt++; + /* Check for empty string like float4in */ + if (*pt == '\0') + ereport(ERROR, + (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), + errmsg("invalid input syntax for type vector: \"%s\"", lit))); + /* Use strtof like float4in to avoid a double-rounding problem */ x[dim] = strtof(pt, &stringEnd); CheckElement(x[dim]);