pg.ddx.io  pgvector/pgvector GitHub issues and pull requests  
help / color / mirror / Atom feed
[pgvector/pgvector] PR #1016: fix sparsevec_to_vector: add index bounds check to prevent out‑of‑bou…
4+ messages / 2 participants
[nested] [flat]

* [pgvector/pgvector] PR #1016: fix sparsevec_to_vector: add index bounds check to prevent out‑of‑bou…
@ 2026-08-12 09:27 "lyinglyingl (@lyinglyingl)" <noreply+lyinglyingl@github.com>
  0 siblings, 0 replies; 4+ messages in thread

From: lyinglyingl (@lyinglyingl) @ 2026-08-12 09:27 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

…nds access

inline patch 1: src/vector.c (+5/-0 lines) download inline-1.patchdiff --git a/src/vector.c b/src/vector.c index b75cfc4b7..447b045fe 100644 --- a/src/vector.c +++ b/src/vector.c @@ -1329,7 +1329,12 @@ sparsevec_to_vector(PG_FUNCTION_ARGS) result = InitVector(dim); for (int i = 0; i < svec->nnz; i++) + { + if (svec->indices[i] < 0 || svec->indices[i] >= dim) + ereport(ERROR, (errcode(ERRCODE_DATA_EXCEPTION), + errmsg("sparsevec index out of bounds"))); result->x[svec->indices[i]] = values[i]; + } PG_RETURN_POINTER(result); }
^ permalink raw [nested|flat] 4+ messages in thread

* Re: [pgvector/pgvector] PR #1016: fix sparsevec_to_vector: add index bounds check to prevent out‑of‑bou…
@ 2026-08-12 15:53 ` "ankane (@ankane)" <noreply+ankane@github.com>
  2 siblings, 0 replies; 4+ messages in thread

From: ankane (@ankane) @ 2026-08-12 15:53 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

Hi @lyinglyingl, I don't see how `indices` would contain an out-of-bounds index, but if you have a reproduction script, please send an email to the [address here](https://github.com/pgvector/pgvector?tab=security-ov-file).

Edit: This could still make sense for hardening.

^ permalink  raw  [nested|flat] 4+ messages in thread

* Re: [pgvector/pgvector] PR #1016: fix sparsevec_to_vector: add index bounds check to prevent out‑of‑bou…
@ 2026-08-12 15:53 ` "ankane (@ankane)" <noreply+ankane@github.com>
  2 siblings, 0 replies; 4+ messages in thread

From: ankane (@ankane) @ 2026-08-12 15:53 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

@ankane closed this.

^ permalink  raw  [nested|flat] 4+ messages in thread

* Re: [pgvector/pgvector] PR #1016: fix sparsevec_to_vector: add index bounds check to prevent out‑of‑bou…
@ 2026-08-14 16:52 ` "ankane (@ankane)" <noreply+ankane@github.com>
  2 siblings, 0 replies; 4+ messages in thread

From: ankane (@ankane) @ 2026-08-14 16:52 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

Merged a version of this in the commit above as part of hardening.

^ permalink  raw  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2026-08-14 16:52 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-08-12 09:27 [pgvector/pgvector] PR #1016: fix sparsevec_to_vector: add index bounds check to prevent out‑of‑bou… "lyinglyingl (@lyinglyingl)" <noreply+lyinglyingl@github.com>
2026-08-12 15:53 ` "ankane (@ankane)" <noreply+ankane@github.com>
2026-08-12 15:53 ` "ankane (@ankane)" <noreply+ankane@github.com>
2026-08-14 16:52 ` "ankane (@ankane)" <noreply+ankane@github.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox