852cff
diff --git a/Tests/test_imagepath.py b/Tests/test_imagepath.py
852cff
index 98a6d34..733fd29 100644
852cff
--- a/Tests/test_imagepath.py
852cff
+++ b/Tests/test_imagepath.py
852cff
@@ -67,6 +67,11 @@ class TestImagePath(PillowTestCase):
852cff
             p = ImagePath.Path(arr.tostring())
852cff
         self.assertEqual(list(p), [(0.0, 1.0)])
852cff
 
852cff
+    def test_getbbox(self):
852cff
+        for coords in (0,1):
852cff
+            p = ImagePath.Path(coords)
852cff
+            self.assertEqual(p.getbbox(), (0.0, 0.0, 0.0, 0.0))
852cff
+
852cff
     def test_overflow_segfault(self):
852cff
         # Some Pythons fail getting the argument as an integer, and it falls
852cff
         # through to the sequence. Seeing this on 32-bit Windows.
852cff
diff --git a/src/path.c b/src/path.c
852cff
index eb1e065..5215f87 100644
852cff
--- a/src/path.c
852cff
+++ b/src/path.c
852cff
@@ -62,7 +62,7 @@ alloc_array(Py_ssize_t count)
852cff
         PyErr_NoMemory();
852cff
         return NULL;
852cff
     }
852cff
-    xy = malloc(2 * count * sizeof(double) + 1);
852cff
+    xy = calloc(2 * count + 1, sizeof(double));
852cff
     if (!xy)
852cff
         PyErr_NoMemory();
852cff
     return xy;
852cff
@@ -330,18 +330,27 @@ path_getbbox(PyPathObject* self, PyObject* args)
852cff
 
852cff
     xy = self->xy;
852cff
 
852cff
-    x0 = x1 = xy[0];
852cff
-    y0 = y1 = xy[1];
852cff
-
852cff
-    for (i = 1; i < self->count; i++) {
852cff
-        if (xy[i+i] < x0)
852cff
-            x0 = xy[i+i];
852cff
-        if (xy[i+i] > x1)
852cff
-            x1 = xy[i+i];
852cff
-        if (xy[i+i+1] < y0)
852cff
-            y0 = xy[i+i+1];
852cff
-        if (xy[i+i+1] > y1)
852cff
-            y1 = xy[i+i+1];
852cff
+    if (self->count == 0) {
852cff
+        x0 = x1 = 0;
852cff
+        y0 = y1 = 0;
852cff
+    } else {
852cff
+        x0 = x1 = xy[0];
852cff
+        y0 = y1 = xy[1];
852cff
+
852cff
+        for (i = 1; i < self->count; i++) {
852cff
+            if (xy[i + i] < x0) {
852cff
+                x0 = xy[i + i];
852cff
+            }
852cff
+            if (xy[i + i] > x1) {
852cff
+                x1 = xy[i + i];
852cff
+            }
852cff
+            if (xy[i + i + 1] < y0) {
852cff
+                y0 = xy[i + i + 1];
852cff
+            }
852cff
+            if (xy[i + i + 1] > y1) {
852cff
+                y1 = xy[i + i + 1];
852cff
+            }
852cff
+        }
852cff
     }
852cff
 
852cff
     return Py_BuildValue("dddd", x0, y0, x1, y1);