Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 261903 Details for
Bug 354193
app-misc/strigi-0.7.2 crash in OleInputStream
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Strigi-0.7.2 OleInputStream patch
strigi-0.7.2-ole.patch (text/plain), 2.38 KB, created by
MarisN
on 2011-02-09 08:03:03 UTC
(
hide
)
Description:
Strigi-0.7.2 OleInputStream patch
Filename:
MIME Type:
Creator:
MarisN
Created:
2011-02-09 08:03:03 UTC
Size:
2.38 KB
patch
obsolete
>diff --git a/lib/oleinputstream.cpp b/lib/oleinputstream.cpp >index c66e200..7286573 100644 >--- src/streams/oleinputstream.cpp >+++ src/streams/oleinputstream.cpp >@@ -173,33 +173,39 @@ OleInputStream::Private::Private(OleInputStream* s, InputStream* input) > stream->m_error = "Invalid OLE file."; > return; > } >- int32_t max = 0; > batIndex.reserve(nBat); > data += 76; > for (int i = 0; i < ::min(109, nBat); ++i) { > int32_t p = readLittleEndianInt32(data+4*i); > batIndex.push_back(p); >- if (p > max) max = p; > } >- if (ptOffset > max) max = ptOffset; >- if (128*(nBat-1) > max) max = 128*(nBat-1); > >- int32_t toread = (max+2)*512; >- if (input->size() >= 0 && input->size() < toread) { >+ // this looks wrong? what's with input->size() < 0 >+ // toread = 10000000 later on, why not bail out here? >+/* if (input->size() >= 0 && input->size() < toread) { > stream->m_status = Error; > stream->m_error = "File is incomplete."; > return; >- } >- toread = (input->size() > 0) ?(int32_t)input->size() :10000000; >- size = input->read(data, toread, toread); >- input->reset(0); >- if (size != input->size()) { >+ }*/ >+ >+ // stop the max block number guessing >+ // check for (nBat - 1) * 128 * 512 <= input-size() < nbat * 128 * 512 >+ // can there be a totally empty bat? (only -1), what happens with file size >+ int32_t minSize = (nBat - 1) * 128 * 512; >+ int32_t maxSize = nBat * 128 * 512; // +64k >+ >+ // we still have a 64k possible error window >+ size = input->read(data, maxSize, maxSize); >+ if (size < minSize) { >+ fprintf(stderr, "minSize: %d vs. size %d \n", minSize, size); > stream->m_status = Error; > stream->m_error > = string("File cannot be read completely: ")+input->error(); > return; > } >- maxindex = size/512-2; >+ input->reset(0); >+ >+ maxindex = size/512-2; // -1 -> header; -2 -> ? > > // read any remaining BAT entries from XBAT blocks > xBatOffset = 512 + 512 * xBatOffset; >@@ -211,6 +217,7 @@ OleInputStream::Private::Private(OleInputStream* s, InputStream* input) > xBatOffset = 512+512*readLittleEndianInt32(data + 508 + xBatOffset); > } > >+// check last sector for no of remaining secIDS > // print all bat blocks > /* for (size_t i = 0; i<batIndex.size(); ++i) { > const char* b = data+(1+batIndex[i])*512;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 354193
: 261903