From: Carsten Schlote <c.schl...@konzeptpark.de>

The following issues are addressed by this patch.

- Check for compressed data to be smaller than the original size. This
  a clear fail and break assumtions at other places (-t option)

- Set the destlen to the expected maximum size, before calling lzo
  decompression routine. It's used a max size value by this code (and
  holds the real decompression size after the call.)

- Calls lzo_init().

Signed-off-by: Carsten Schlote <c.schl...@konzeptpark.de>
---
 patches/mtd-utils-1.3.0/lzo-compr-fixes.patch |   59 +++++++++++++++++++++++++
 patches/mtd-utils-1.3.0/series                |    3 +
 2 files changed, 62 insertions(+), 0 deletions(-)
 create mode 100644 patches/mtd-utils-1.3.0/lzo-compr-fixes.patch
 create mode 100644 patches/mtd-utils-1.3.0/series

diff --git a/patches/mtd-utils-1.3.0/lzo-compr-fixes.patch 
b/patches/mtd-utils-1.3.0/lzo-compr-fixes.patch
new file mode 100644
index 0000000..132d304
--- /dev/null
+++ b/patches/mtd-utils-1.3.0/lzo-compr-fixes.patch
@@ -0,0 +1,59 @@
+From: Carsten Schlote <c.schl...@konzeptpark.de>
+Date: Fri, 20 Mar 2009 12:43:32 +0100
+Subject: [PATCH 1/1] [lzo compressor] Fixed lzo compression tests and crash 
caused by unset variable.
+
+The following issues are addressed by this patch.
+
+- Check for compressed data to be smaller than the original size. This
+  a clear fail and break assumtions at other places (-t option)
+
+- Set the destlen to the expected maximum size, before calling lzo
+  decompression routine. It's used a max size value by this code (and
+  holds the real decompression size after the call.)
+
+- Calls lzo_init().
+
+Signed-off-by: Carsten Schlote <c.schl...@konzeptpark.de>
+---
+ compr_lzo.c |   14 +++++++++++---
+ 1 file changed, 11 insertions(+), 3 deletions(-)
+
+Index: compr_lzo.c
+===================================================================
+--- compr_lzo.c.orig   2009-07-03 11:31:41.000000000 +0200
++++ compr_lzo.c        2009-07-22 11:47:04.000000000 +0200
+@@ -56,6 +56,9 @@
+       if (ret != LZO_E_OK)
+               return -1;
+ 
++      if (compress_size > *sourcelen)
++              return -1;
++
+       if (compress_size > *dstlen)
+               return -1;
+ 
+@@ -71,6 +74,7 @@
+       int ret;
+       lzo_uint dl;
+ 
++      dl = destlen;
+       ret = lzo1x_decompress_safe(data_in,srclen,cpage_out,&dl,NULL);
+ 
+       if (ret != LZO_E_OK || dl != destlen)
+@@ -92,11 +96,15 @@
+ {
+       int ret;
+ 
++      lzo_init();
++
+       lzo_mem = malloc(LZO1X_999_MEM_COMPRESS);
+       if (!lzo_mem)
+               return -1;
+ 
+-      /* Worse case LZO compression size from their FAQ */
++      /* Worse case LZO compression size from their FAQ -
++              see  http://www.oberhumer.com/opensource/lzo/lzofaq.php */
++
+       lzo_compress_buf = malloc(page_size + (page_size / 16) + 64 + 3);
+       if (!lzo_compress_buf) {
+               free(lzo_mem);
diff --git a/patches/mtd-utils-1.3.0/series b/patches/mtd-utils-1.3.0/series
new file mode 100644
index 0000000..721ea5d
--- /dev/null
+++ b/patches/mtd-utils-1.3.0/series
@@ -0,0 +1,3 @@
+0001-make-liblzo-optional.patch
+lzo-compr-fixes.patch -p0
+
-- 
1.6.5.6.gb3118


--
ptxdist mailing list
ptxdist@pengutronix.de

Reply via email to