[coreboot] nrv2b cleanup patch

Myles Watson mylesgw at gmail.com
Tue Mar 25 20:10:31 CET 2008


This fixes silent memory corruption with both lzma and nrv2b when the
compressed length is larger than the original.  I admit that it should be
infrequent, but better safe than sorry.


> -----Original Message-----
> From: Myles Watson [mailto:mylesgw at gmail.com]
> Sent: Thursday, March 13, 2008 4:55 PM
> To: Coreboot
> Subject: Re: nrv2b cleanup patch
> On Thu, Mar 13, 2008 at 2:14 PM, Myles Watson <mylesgw at gmail.com> wrote:
> > This patch changes do_nrv2b_compress to act like do_lzma_compress.  In
> other
> >  words, it now allocates and frees its own memory.  This saves lar from
> having
> >  to know about worst case compression to avoid memory corruption.
> >
> >  Tested by building coreboot with nrv2b as default, then copying to an
> lzma lar,
> >  then copying back to an nrv2b lar.  No differences.
> >
> This patch adds comments to lar_compress, do_lzma_compress, and
> do_nrv2b_compress.  It also checks to make sure that the compressed
> size is smaller than the input size before copying the data back.
> Myles
> Signed-off-by: Myles Watson <mylesgw at gmail.com>

More information about the coreboot mailing list