This repository contains a custom node for ComfyUI that pads an image to be square, filling the new pixels black.
https://github.com/chrissy0/chris-comfyui-nodes
git clone https://github.com/chrissy0/chris-comfyui-nodes
comfy node install chris-comfyui-nodes