Skip to content

Commit 1009f0c

Browse files
committed
Add patch for zstandard
1 parent 5c9d2a2 commit 1009f0c

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[[rules]]
2+
patch = 'zstandard.patch'
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
diff --git a/c-ext/backend_c.c b/c-ext/backend_c.c
2+
index 6edcd52..12ee7c1 100644
3+
--- a/c-ext/backend_c.c
4+
+++ b/c-ext/backend_c.c
5+
@@ -313,7 +313,12 @@ size_t roundpow2(size_t i) {
6+
int safe_pybytes_resize(PyObject **obj, Py_ssize_t size) {
7+
PyObject *tmp;
8+
9+
- if (Py_REFCNT((*obj)) == 1) {
10+
+ /*
11+
+ * GraalPy change: we don't want to randomly fall through to the code
12+
+ * below, because it doesn't handle all cases (shrinking) and causes memory
13+
+ * corruption
14+
+ */
15+
+ if (/* Py_REFCNT((*obj)) == 1 */ 1) {
16+
return _PyBytes_Resize(obj, size);
17+
}
18+

0 commit comments

Comments
 (0)