graingert / python-clamd

Clamd is a python interface to Clamd (Clamav daemon). By using Clamd, you can add virus detection capabilities to your python software in an efficient and easy way.
82 stars 39 forks source link

Bugfixes and Improvements #23

Open mrname opened 3 years ago

mrname commented 3 years ago

A few bugfixes and improvements:

nilstoedtmann commented 3 years ago

We are observing a similar issue, where python-clamd sends an incomplete INSTREAM chunk at some point (in one case it was chunk no #1012). Once that happens, the chunks get misaligned, the clamd service parses the next chunk's length from the wrong bytes and all sorts of entertaining nonsense ensues. We are also using gevent, so this is a hot candidate for causing our issue.

nilstoedtmann commented 3 years ago

Regarding max_chunk_size:

If I understand the clamd protocol correctly, then StreamMaxLength is the maximum total length of all chunks together, not of the individual chunks. So what is the disadvantage of sending the whole buffer in a single chunk anyway, regardless of size?

stringfellow commented 3 years ago

@graingert - do you have any space to look at this PR? The change-set fixes what is (for us) a major and intermittent bug, and it would be great to be using master release version, rather than a branch :)

Viicos commented 12 months ago

Although a few forks have been created (https://pypi.org/project/pyClamd/, https://github.com/ranguli/clammy), they now seem unmaintained (last one was archived recently).

I've made yet another fork here: https://github.com/Viicos/clamdpy. Improvements from this PR have been included, and type hints are included. Credit goes to https://github.com/graingert/python-clamd/