On (25/02/23 08:14), Herbert Xu wrote: > On Sat, Feb 22, 2025 at 11:27:49PM +0900, Sergey Senozhatsky wrote: > > > > So I didn't look at all of them, but at least S/W lzo1 doesn't even > > have a notion of max-output-len. lzo1x_1_compress() accepts a pointer > > to out_len which tells the size of output stream (the algorithm is free > > to produce any), so there is no dst_buf overflow as far as lzo1 is > > concerned. Unless I'm missing something or misunderstanding your points. > > I just looked at deflate/zstd and they seem to be doing the right > things. > > But yes lzo is a gaping security hole on the compression side. Right, for lzo/lzo-rle we need a safety page. It also seems that there is no common way of reporting dst_but overflow. Some algos return -ENOSPC immediately, some don't return anything at all, and deflate does it's own thing - there are these places where they see they are out of out space but they Z_OK it if (s->pending != 0) { flush_pending(strm); if (strm->avail_out == 0) { /* Since avail_out is 0, deflate will be called again with * more output space, but possibly with both pending and * avail_in equal to zero. There won't be anything to do, * but this is not an error situation so make sure we * return OK instead of BUF_ERROR at next call of deflate: */ s->last_flush = -1; return Z_OK; } }