Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
af0eb65
gh-150449: Fix sqlite3.Blob crash with negative-step slices
ever0de May 26, 2026
85312b4
gh-150449: validate slice assignment size even for empty slices
ever0de May 26, 2026
c0c2018
gh-150449: add tests for negative-step slices with start <= stop
ever0de May 26, 2026
83d3a3c
Fix PEP 7 line-length violations in blob.c (ass_subscript_slice)
ever0de May 26, 2026
f7c9f53
gh-150449: Address review: docs, tests, and rename write_offset
ever0de May 30, 2026
5087b42
gh-150449: Fix versionchanged version: use 'next' not '3.16'
ever0de May 30, 2026
d774ab7
gh-150449: Fix wording in NEWS and whatsnew: 'crash' → 'raise SystemE…
ever0de May 30, 2026
5bf02de
gh-150449: Remove redundant issue references from test comments
ever0de May 30, 2026
c311c8e
Merge remote-tracking branch 'upstream/main' into gh-150449-fix-sqlit…
ever0de May 30, 2026
d4b4b43
gh-150449: Fix missing blank line after xml section in whatsnew
ever0de May 30, 2026
0936d6b
gh-150449: Rename read_length to write_length in ass_subscript_slice
ever0de May 30, 2026
5f2f916
gh-150449: Move empty-slice validation fix to dedicated PR for gh-150913
ever0de Jun 4, 2026
d47abf8
Merge remote-tracking branch 'upstream/main' into gh-150449-fix-sqlit…
ever0de Jun 4, 2026
be1aa18
gh-150449: Add tests for extreme step values in sqlite3.Blob slice op…
ever0de Jun 5, 2026
f76ebf7
gh-150449: Assert correctness of extreme-step slice assignment in sql…
ever0de Jun 5, 2026
52084f9
gh-150449: Isolate extreme-step Blob assignment tests
ever0de Jun 5, 2026
a462e70
Merge branch 'main' into gh-150449-fix-sqlite-blob-negative-step-slice
serhiy-storchaka Jun 8, 2026
d6e07f5
Merge branch 'main' into gh-150449-fix-sqlite-blob-negative-step-slice
serhiy-storchaka Aug 11, 2026
98fc681
Merge branch 'main' into gh-150449-fix-sqlite-blob-negative-step-slice
serhiy-storchaka Aug 13, 2026
c587f21
Merge branch 'main' into gh-150449-fix-sqlite-blob-negative-step-slice
serhiy-storchaka Aug 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Merge branch 'main' into gh-150449-fix-sqlite-blob-negative-step-slice
Resolve the conflict in ass_subscript_slice(): keep the region computation
which handles negative and extreme steps, and read it into a plain buffer
as in gh-155702, instead of patching the bytes object read from the blob.
  • Loading branch information
serhiy-storchaka committed Aug 14, 2026
commit c587f21bb459f7690ff7d93108679601388feb97
35 changes: 21 additions & 14 deletions Modules/_sqlite/blob.c
Original file line number Diff line number Diff line change
Expand Up @@ -571,24 +571,31 @@ ass_subscript_slice(pysqlite_Blob *self, PyObject *item, PyObject *value)
rc = inner_write(self, vbuf.buf, len, start);
}
else {
// Compute the contiguous blob region covering all slice elements, then
// update each element using the standard size_t-cursor pattern that
// handles both positive and negative steps via unsigned arithmetic.
/* Compute the contiguous blob region covering all slice elements,
read it, patch each element and write it back. The object
returned by read_multiple() cannot be used as the buffer, because
for a single byte it is an immortal singleton. */
Py_ssize_t last = start + (len - 1) * step;
Py_ssize_t write_offset = Py_MIN(start, last);
Py_ssize_t write_length = Py_ABS(start - last) + 1;
PyObject *blob_bytes = read_multiple(self, write_length, write_offset);
if (blob_bytes != NULL) {
char *blob_buf = PyBytes_AS_STRING(blob_bytes);
size_t cur;
Py_ssize_t i;
for (cur = (size_t)start, i = 0; i < len;
cur += (size_t)step, i++) {
blob_buf[(Py_ssize_t)cur - write_offset] =
((char *)vbuf.buf)[i];
char *buf = PyMem_Malloc(write_length);
if (buf == NULL) {
PyErr_NoMemory();
}
else {
if (inner_read(self, buf, write_length, write_offset) == 0) {
/* The size_t cursor handles both positive and negative steps
via unsigned arithmetic. */
size_t cur;
Py_ssize_t i;
for (cur = (size_t)start, i = 0; i < len;
cur += (size_t)step, i++) {
buf[(Py_ssize_t)cur - write_offset] =
((char *)vbuf.buf)[i];
}
rc = inner_write(self, buf, write_length, write_offset);
}
rc = inner_write(self, blob_buf, write_length, write_offset);
Py_DECREF(blob_bytes);
PyMem_Free(buf);
}
}
PyBuffer_Release(&vbuf);
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.