Use of Max Resolution on Image Field causes ClamAV Timeout in Deamon mode

Created on 29 May 2019, over 5 years ago
Updated 9 April 2024, 9 months ago

If using the `max_resolution` setting on an image field in Drupal 8, that image processing appears to break ClamAV functionality. Our file field is configured with the following Maximum Image Resolution (see maxResolution.jpg):

"Images larger than 150x75 pixels will be resized"

With a maximum resolution set, the $file passed into DaemonTCPIP::scan() is actually a resized thumbnail of the original image. However, $file->getSize() reports the original image size not the resized one. (Calling fstat($file_hander) does show the correct number of bytes for the smaller, resized file and not the larger, original size of the original thumbnail).

This incorrect file size behavior leads to a timeout error when communicating with ClamAV. This module basically says "I'm about to send you (original file size) bytes" and then sends the smaller resized image. ClamAV never receives the full payload it's expecting and so it never returns a result - instead, the $response = trim(fgets($scanner_handler)); blocks until the connection times out.

🐛 Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

🇺🇸United States bygeoffthompson

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024