[libgsf] ole: only read amount needed from block



commit 165fb60121f3029cd3ef12ebecb612bf5c129d10
Author: Marc-André Lureau <marcandre lureau gmail com>
Date:   Wed Dec 19 21:24:46 2012 +0100

    ole: only read amount needed from block
    
    Some OLE files are not multiple of block size, and may file to read
    the last block when its size is smaller.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=690524

 gsf/gsf-infile-msole.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/gsf/gsf-infile-msole.c b/gsf/gsf-infile-msole.c
index 4891d01..4488ad1 100644
--- a/gsf/gsf-infile-msole.c
+++ b/gsf/gsf-infile-msole.c
@@ -706,7 +706,9 @@ gsf_infile_msole_read (GsfInput *input, size_t num_bytes, guint8 *buffer)
                count = ole->info->bb.size - offset;
                if (count > num_bytes)
                        count = num_bytes;
-               data = ole_get_block (ole, ole->bat.block [i], NULL);
+               if (!ole_seek_block (ole, ole->bat.block [i], 0))
+                       return NULL;
+               data = gsf_input_read (ole->input, count, NULL);
                if (data == NULL)
                        return NULL;
 


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