mirror of
https://github.com/hanzoai/sql-vector.git
synced 2026-10-01 00:37:19 +00:00
Added extra bytes to buffer for safety in the event of negative integers [skip ci]
(cherry picked from commit 29e94adf7942a350669aad1b14dc3410a6f2d0f3)
This commit is contained in:
+3
-3
@@ -427,7 +427,7 @@ sparsevec_out(PG_FUNCTION_ARGS)
|
||||
/*
|
||||
* Need:
|
||||
*
|
||||
* nnz * 10 bytes for index (positive integer)
|
||||
* nnz * 11 bytes for index (includes sign for extra safety)
|
||||
*
|
||||
* nnz bytes for :
|
||||
*
|
||||
@@ -436,11 +436,11 @@ sparsevec_out(PG_FUNCTION_ARGS)
|
||||
*
|
||||
* max(nnz - 1, 0) bytes for ,
|
||||
*
|
||||
* 10 bytes for dimensions
|
||||
* 11 bytes for dimensions (includes sign for extra safety)
|
||||
*
|
||||
* 4 bytes for {, }, /, and \0
|
||||
*/
|
||||
buf = (char *) palloc((11 + FLOAT_SHORTEST_DECIMAL_LEN) * sparsevec->nnz + 14);
|
||||
buf = (char *) palloc((12 + FLOAT_SHORTEST_DECIMAL_LEN) * sparsevec->nnz + 15);
|
||||
ptr = buf;
|
||||
|
||||
AppendChar(ptr, '{');
|
||||
|
||||
Reference in New Issue
Block a user