Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
LinZhihao-723 committed Nov 27, 2024
1 parent 0c66d04 commit 61c23e8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/clp_ffi_py/ir/native/PyDeserializerBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@ PyDoc_STRVAR(
} // namespace

auto PyDeserializerBuffer::init(PyObject* input_stream, Py_ssize_t buf_capacity) -> bool {
if (0 >= buf_capacity) {
PyErr_SetString(PyExc_ValueError, "The given buffer capacity must be greater than 0.");
return false;
}
m_read_buffer_mem_owner = static_cast<int8_t*>(PyMem_Malloc(buf_capacity));
if (nullptr == m_read_buffer_mem_owner) {
PyErr_NoMemory();
Expand Down

0 comments on commit 61c23e8

Please sign in to comment.