From 23f89ee747655ae7b637d80b805ec5f3ce7c7717 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Wed, 9 Sep 2015 14:08:29 -1000 Subject: [PATCH] Buffer access fixes --- DataSpec/DNACommon/CMDL.hpp | 10 ++++++++-- DataSpec/DNACommon/PAK.hpp | 5 +++-- hecl | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/DataSpec/DNACommon/CMDL.hpp b/DataSpec/DNACommon/CMDL.hpp index f4b14118e..7a0167c0b 100644 --- a/DataSpec/DNACommon/CMDL.hpp +++ b/DataSpec/DNACommon/CMDL.hpp @@ -188,10 +188,14 @@ class DLReader { case GX::DIRECT: case GX::INDEX8: + if ((m_cur - m_dl.get()) >= intptr_t(m_dlSize)) + return 0; retval = *m_cur; ++m_cur; break; case GX::INDEX16: + if ((m_cur - m_dl.get() + 1) >= intptr_t(m_dlSize)) + return 0; retval = HECL::SBig(*(atUint16*)m_cur); m_cur += 2; break; @@ -207,7 +211,7 @@ public: } operator bool() { - return *m_cur && ((m_cur - m_dl.get()) < intptr_t(m_dlSize)); + return ((m_cur - m_dl.get()) < intptr_t(m_dlSize)) && *m_cur; } GX::Primitive readPrimitive() { @@ -215,7 +219,9 @@ public: } atUint16 readVertCount() { - return readVal(GX::INDEX16); + atUint16 retval = HECL::SBig(*(atUint16*)m_cur); + m_cur += 2; + return retval; } struct DLPrimVert { diff --git a/DataSpec/DNACommon/PAK.hpp b/DataSpec/DNACommon/PAK.hpp index 08a59c841..b11c778e8 100644 --- a/DataSpec/DNACommon/PAK.hpp +++ b/DataSpec/DNACommon/PAK.hpp @@ -348,9 +348,10 @@ public: if (extractor.weight != w) continue; - HECL::SystemStringView bestName(getBestEntryName(*item.second)); + std::string bestName = getBestEntryName(*item.second); + HECL::SystemStringView bestNameView(bestName); float thisFac = ++count / fsz; - progress(bestName.sys_str().c_str(), thisFac); + progress(bestNameView.sys_str().c_str(), thisFac); HECL::ProjectPath cooked = getCooked(item.second); if (force || cooked.getPathType() == HECL::ProjectPath::PT_NONE) diff --git a/hecl b/hecl index 168429814..0935dad69 160000 --- a/hecl +++ b/hecl @@ -1 +1 @@ -Subproject commit 168429814320c39b063cfee37c85261dc01c3305 +Subproject commit 0935dad69fb8ac18556d280b9886aad11fafec78