Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:12.1:Update
strigi
bko_251701.v3.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File bko_251701.v3.patch of Package strigi
diff --git a/lib/oleinputstream.cpp b/lib/oleinputstream.cpp index c66e200..7286573 100644 --- a/libstreams/lib/oleinputstream.cpp +++ b/libstreams/lib/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;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor