vladmandic / automatic

SD.Next: Advanced Implementation of Stable Diffusion and other Diffusion-based generative image models
https://github.com/vladmandic/automatic
GNU Affero General Public License v3.0
5.71k stars 423 forks source link

[Issue]: Inpaint sketch leading to DecompressionBombError #860

Closed mark-wd closed 1 year ago

mark-wd commented 1 year ago

Issue Description

Cannot say when this started as I did not use this feature before. When attempting to inpaint sketch an image (512wx768h in this case), the process fails and throws the error below. It implies that a size limit is being exceeded. The image comes straight from txt2img.

Traceback (most recent call last):
  File "G:\stable-diffusion-vladmandic\venv\lib\site-packages\gradio\routes.py", line 399, in run_predict
    output = await app.get_blocks().process_api(
  File "G:\stable-diffusion-vladmandic\venv\lib\site-packages\gradio\blocks.py", line 1297, in process_api
    inputs = self.preprocess_data(fn_index, inputs, state)
  File "G:\stable-diffusion-vladmandic\venv\lib\site-packages\gradio\blocks.py", line 1145, in preprocess_data
    processed_input.append(block.preprocess(inputs[i]))
  File "G:\stable-diffusion-vladmandic\venv\lib\site-packages\gradio\components.py", line 1784, in preprocess
    im = processing_utils.decode_base64_to_image(x)
  File "G:\stable-diffusion-vladmandic\venv\lib\site-packages\gradio\processing_utils.py", line 48, in decode_base64_to_image
    img = Image.open(BytesIO(base64.b64decode(image_encoded)))
  File "G:\stable-diffusion-vladmandic\venv\lib\site-packages\PIL\Image.py", line 3277, in open
    im = _open_core(fp, filename, prefix, formats)
  File "G:\stable-diffusion-vladmandic\venv\lib\site-packages\PIL\Image.py", line 3264, in _open_core
    _decompression_bomb_check(im.size)
  File "G:\stable-diffusion-vladmandic\venv\lib\site-packages\PIL\Image.py", line 3173, in _decompression_bomb_check
    raise DecompressionBombError(msg)
PIL.Image.DecompressionBombError: Image size (233494560 pixels) exceeds limit of 178956970 pixels, could be decompression bomb DOS attack.

Version Platform Description

2023-05-09 hash: 1288aec4 Model: Deliberate V2 cuda: 11.8 cudnn: 8700

vladmandic commented 1 year ago

i cannot reproduce, can you walk me through exact steps? resulting image seems to be 15k x 15k pixels and that causes failure, its almost like resize by was set to 30x.

vladmandic commented 1 year ago

i've improved checks and logging in that area, hopefully it resolves it. if issue persists, reopen and post logs.