Skip to content

Commit 3ea8788

Browse files
authored
Fix integer overflow in decoding (#39)
1 parent 25e180a commit 3ea8788

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/python-codec.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ static PyObject *py_hdr_decode(PyObject *self, PyObject *args) {
364364
}
365365
}
366366
}
367-
return Py_BuildValue("{s:i,s:i,s:i}",
367+
return Py_BuildValue("{s:L,s:L,s:L}",
368368
"total", total_count,
369369
"min_nonzero_index", min_nonzero_index,
370370
"max_nonzero_index", max_nonzero_index);
@@ -457,7 +457,7 @@ static PyObject *py_hdr_add_array(PyObject *self, PyObject *args) {
457457
PyErr_SetString(PyExc_ValueError, "Invalid word size");
458458
return NULL;
459459
}
460-
return Py_BuildValue("i", total_count);
460+
return Py_BuildValue("L", total_count);
461461
}
462462

463463
#define ENCODE_DOCSTRING "Encode a counts array into a V2 varint buffer"

0 commit comments

Comments
 (0)