[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gzio is broken
From: |
Timothy Baldwin |
Subject: |
gzio is broken |
Date: |
Sat, 15 Oct 2005 01:47:32 +0100 |
User-agent: |
KMail/1.8.2 |
Problem 1: In the function test_header, the array buf is accessed via pointers
to grub_uint32_t and grub_uint16_t without ensuring correct alignment of the
pointers. This does not work on ARM. Fixed by:
2005-10-15 Timothy Baldwin <address@hidden>
* io/gzio.c (test_header): Align buf.
diff -purN -x '*.mk' -x '*~' -x autom4te.cache -x configure -x '.#*' -x
'*.orig' -x CVS grub2-submitted/io/gzio.c grub2-split/io/gzio.c
--- grub2-submitted/io/gzio.c 2005-08-22 18:28:59.000000000 +0100
+++ grub2-split/io/gzio.c 2005-10-14 22:49:55.000000000 +0100
@@ -165,7 +165,7 @@ typedef unsigned long ulg;
static int
test_header (grub_file_t file)
{
- unsigned char buf[10];
+ unsigned char buf[10] __attribute__((aligned));
grub_gzio_t gzio = file->data;
if (grub_file_tell (gzio->file) != 0)
Problem 2: Reading gzip files all at once results in corruption of the data.
It can be exposed by this patch:
diff -purN -x '*.mk' -x '*~' -x autom4te.cache -x configure -x '.#*' -x
'*.orig' -x CVS grub2-submitted/commands/cmp.c grub2-split/commands/cmp.c
--- grub2-submitted/commands/cmp.c 2005-08-26 09:04:11.000000000 +0100
+++ grub2-split/commands/cmp.c 2005-10-15 00:44:12.000000000 +0100
@@ -26,7 +26,7 @@
#include <grub/mm.h>
#include <grub/gzio.h>
-#define BUFFER_SIZE 512
+#define BUFFER_SIZE 1024*1024*4
static grub_err_t
grub_cmd_cmp (struct grub_arg_list *state __attribute__ ((unused)),
Test file at:
http://www.majoroak.f2s.com/tim/grub/downloads/grub2-20051007.tar.gz
Valgrind output attached.
--
Member AFFS, WYLUG, SWP (UK), UAF, RESPECT, StWC
No to software patents! Victory to the iraqi resistance!
valgrind
Description: Text document
pgpWoUiu5gE0P.pgp
Description: PGP signature
- gzio is broken,
Timothy Baldwin <=