mirror of
https://github.com/hanzoai/sql-vector.git
synced 2026-10-01 00:37:19 +00:00
Added extra byte to buffers for safety in the event of an empty vector [skip ci]
(cherry picked from commit a3cf81a784169dacb7785e6a757cf6ebae15371a)
This commit is contained in:
+2
-2
@@ -300,11 +300,11 @@ halfvec_out(PG_FUNCTION_ARGS)
|
||||
* dim * (FLOAT_SHORTEST_DECIMAL_LEN - 1) bytes for
|
||||
* float_to_shortest_decimal_bufn
|
||||
*
|
||||
* dim - 1 bytes for separator
|
||||
* max(dim - 1, 0) bytes for separator
|
||||
*
|
||||
* 3 bytes for [, ], and \0
|
||||
*/
|
||||
buf = (char *) palloc(FLOAT_SHORTEST_DECIMAL_LEN * dim + 2);
|
||||
buf = (char *) palloc(FLOAT_SHORTEST_DECIMAL_LEN * dim + 3);
|
||||
ptr = buf;
|
||||
|
||||
AppendChar(ptr, '[');
|
||||
|
||||
+2
-2
@@ -295,11 +295,11 @@ vector_out(PG_FUNCTION_ARGS)
|
||||
* dim * (FLOAT_SHORTEST_DECIMAL_LEN - 1) bytes for
|
||||
* float_to_shortest_decimal_bufn
|
||||
*
|
||||
* dim - 1 bytes for separator
|
||||
* max(dim - 1, 0) bytes for separator
|
||||
*
|
||||
* 3 bytes for [, ], and \0
|
||||
*/
|
||||
buf = (char *) palloc(FLOAT_SHORTEST_DECIMAL_LEN * dim + 2);
|
||||
buf = (char *) palloc(FLOAT_SHORTEST_DECIMAL_LEN * dim + 3);
|
||||
ptr = buf;
|
||||
|
||||
AppendChar(ptr, '[');
|
||||
|
||||
Reference in New Issue
Block a user