- Merge request !4Issue #3058018: Use of Max Resolution on Image Field causes ClamAV Timeout in Deamon mode → (Open) created by hswong3i
- 🇫🇷France O'Briat Nantes
@ifcarrionc_globant. Strange, my core patch works on my website for some months now...
Your patch seems correct (do not trust the file object and reloading the current file size), but could you please test again mine just to check that I didn't miss something.
Thanks - 🇸🇮Slovenia KlemenDEV
I can confirm applying patch from #3292350 fixes this issue too
- 🇦🇺Australia sime Melbourne
https://www.drupal.org/project/drupal/issues/3292350#comment-15324953 🐛 file_validate_image_resolution does not update file size after resizing Needs work worked for me.
- First commit to issue fork.
Updated the MR incorporating @ifcarrionc_globant's latest fix, adding support for unix sockets as well.
Reading the filesize from the resource seems like the most stable way to address the issue.
- 🇬🇧United Kingdom manarth
The switch between "N" (unsigned long (always 32 bit, big endian byte order) and "J" (unsigned long long (always 64 bit, big endian byte order) doesn't appear to fit with the ClamAV docs for INSTREAM.
https://linux.die.net/man/8/clamd
The format of the chunk is: '[length][data]' where [length] is the size of the following data in bytes expressed as a 4 byte unsigned integer
Could this be specific to a particular ClamAV version?
- 🇬🇧United Kingdom manarth
It looks like the main branch of ClamAV is still using an unsigned 32bit value to calculate the chunk size – https://github.com/Cisco-Talos/clamav/blob/main/clamd/server-th.c#L830
I'd be extremely reluctant to change the pack definition from 32bit to 64bit without a thorough understanding of the root cause.
- 🇫🇷France O'Briat Nantes
The core patch https://www.drupal.org/project/drupal/issues/3292350 🐛 file_validate_image_resolution does not update file size after resizing Needs work will be included in the next drupal release, it should fix this issue. Can some one check is there is still work on this issue? If so, maybe update the issue name and description or open a new issue?
I think you're right @manarth, I just attempted to incorporate the original approach suggested in the original @ThirstySix MR since I thought it was solving a different variation of the issue.
Using the 64bit "J" version lead to broken pipe issues:
Notice: stream_copy_to_stream(): Send of 424 bytes failed with errno=32 Broken pipe in Drupal\clamav\Scanner\DaemonTCPIP->scan()
Notice: fwrite(): Send of 8 bytes failed with errno=32 Broken pipe in Drupal\clamav\Scanner\DaemonTCPIP->scan()
And I've swiftly updated the MR as appropriate.
- 🇫🇷France O'Briat Nantes
https://www.drupal.org/project/drupal/issues/3292350 🐛 file_validate_image_resolution does not update file size after resizing Needs work should fix the problem, is there other use case that prevent to close this issue?