Re: [PATCH] lib/lzo: Avoid output overruns when compressing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Feb 26, 2025 at 02:00:37PM +0100, David Sterba wrote:
>
> Does it have to check for the overruns? The worst case compression
> result size is known and can be calculated by the formula. Using big

If the caller is using different algorithms, then yes the checks
are essential.  Otherwise the caller would have to allocate enough
memory not just for LZO, but for the worst-case compression length
for *any* algorithm.  Adding a single algorithm would have the
potential of breaking all users.
 
> What strikes me as alarming that you insert about 20 branches into a
> realtime compression algorithm, where everything is basically a hot
> path.  Branches that almost never happen, and never if the output buffer
> is big enough.

OK, if that is a real concern then I will add a _safe version of
LZO compression alongside the existing code.

Cheers,
-- 
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt




[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]
  Powered by Linux