Skip to content

Commit 1e09241

Browse files
committed
Initialize coordinates to zero
1 parent 89d0d38 commit 1e09241

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

Tests/test_imagepath.py

+1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ def test_path_odd_number_of_coordinates():
9090
[
9191
([0, 1, 2, 3], (0.0, 1.0, 2.0, 3.0)),
9292
([3, 2, 1, 0], (1.0, 0.0, 3.0, 2.0)),
93+
(1, (0.0, 0.0, 0.0, 0.0)),
9394
],
9495
)
9596
def test_getbbox(coords, expected):

src/path.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ alloc_array(Py_ssize_t count) {
5757
if ((unsigned long long)count > (SIZE_MAX / (2 * sizeof(double))) - 1) {
5858
return ImagingError_MemoryError();
5959
}
60-
xy = malloc(2 * count * sizeof(double) + 1);
60+
xy = calloc(2 * count * sizeof(double) + 1, sizeof(double));
6161
if (!xy) {
6262
ImagingError_MemoryError();
6363
}

0 commit comments

Comments
 (0)