From 1f717903bc12088ff5a90036a4ece3f8dc2a0962 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sat, 11 Mar 2023 12:48:28 -0500 Subject: [PATCH] Prevent potential int overflow in SaveImage --- nodes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nodes.py b/nodes.py index 7c88402f..814f76a7 100644 --- a/nodes.py +++ b/nodes.py @@ -790,7 +790,7 @@ class SaveImage: paths = list() for image in images: i = 255. * image.cpu().numpy() - img = Image.fromarray(i.astype(np.uint8)) + img = Image.fromarray(np.clip(i, 0, 255).astype(np.uint8)) metadata = PngInfo() if prompt is not None: metadata.add_text("prompt", json.dumps(prompt))