diff options
author | Daniel Brahneborg <basic@chello.se> | 2002-04-14 12:03:02 +0000 |
---|---|---|
committer | Daniel Brahneborg <basic@chello.se> | 2002-04-14 12:03:02 +0000 |
commit | f1f20db42313032578ba256903d0004dd126a60a (patch) | |
tree | 228e3636eaa61d89f35bea8fd782b095758e88ca /lib/siscomponentrecord.cpp | |
parent | 06e892c7ae2f4d542b6e6aa4549c9585857087b6 (diff) | |
download | plptools-f1f20db42313032578ba256903d0004dd126a60a.tar.gz plptools-f1f20db42313032578ba256903d0004dd126a60a.tar.bz2 plptools-f1f20db42313032578ba256903d0004dd126a60a.zip |
More correct residual sis file truncation
Diffstat (limited to 'lib/siscomponentrecord.cpp')
-rw-r--r-- | lib/siscomponentrecord.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/siscomponentrecord.cpp b/lib/siscomponentrecord.cpp index 3507bce..ac5ba6d 100644 --- a/lib/siscomponentrecord.cpp +++ b/lib/siscomponentrecord.cpp @@ -35,12 +35,15 @@ SISComponentNameRecord::~SISComponentNameRecord() } SisRC -SISComponentNameRecord::fillFrom(uint8_t* buf, int base, off_t len, +SISComponentNameRecord::fillFrom(uint8_t* buf, int* basePos, off_t len, SISFile* sisFile) { int n = sisFile->m_header.m_nlangs; - if (base + 8 + n * 4 * 2 > len) + int base = *basePos; + int entrySize = 8 + n * 4 * 2; + if (base + entrySize > len) return SIS_TRUNCATED; + *basePos += entrySize; uint8_t* p = buf + base; int size = 0; @@ -90,6 +93,19 @@ SISComponentNameRecord::fillFrom(uint8_t* buf, int base, off_t len, return SIS_OK; } +uint32_t +SISComponentNameRecord::getLastEnd() +{ + uint32_t last = 0; + for (int i = 0; i < m_nameCount; ++i) + { + uint32_t pos = m_namePtrs[i] + m_nameLengths[i]; + if (last < pos) + last = pos; + } + return last; +} + uint8_t* SISComponentNameRecord::getName(int no) { |