Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS 5 CFI Assertion Parse Fix #19

Closed
wants to merge 8 commits into from
Closed
5 changes: 2 additions & 3 deletions Platform/Apple/ePub3.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1916,7 +1916,7 @@
ABA72C1B1655382E003125FF /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0460;
LastUpgradeCheck = 0500;
ORGANIZATIONNAME = "The Readium Foundation and contributors";
};
buildConfigurationList = ABA72C1E1655382E003125FF /* Build configuration list for PBXProject "ePub3" */;
Expand Down Expand Up @@ -2365,7 +2365,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_WARN_EMPTY_BODY = YES;
Expand Down Expand Up @@ -2395,7 +2394,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_WARN_EMPTY_BODY = YES;
Expand All @@ -2408,6 +2406,7 @@
"BUILDING_EPUB3=1",
"NDEBUG=1",
);
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
Expand Down
5 changes: 4 additions & 1 deletion ePub3/ePub/cfi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,10 @@ void CFI::Component::Parse(const string &str)
case '[':
{
size_t pos = static_cast<size_t>(iss.tellg());
iss.ignore(std::numeric_limits<std::streamsize>::max(), ']');
while ( !iss.eof() && next != ']' )
{
iss >> next;
}
size_t end = ((size_t)iss.tellg()) - 1;

if ( iss.eof() )
Expand Down
62 changes: 32 additions & 30 deletions ePub3/ePub/package.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -923,39 +923,41 @@ bool Package::Unpack()
}
else
{
try
{
ManifestItemPtr tocItem = ManifestItemWithID(tocNames[0]);
if (!bool(tocItem))
throw EPUBError::OPFNoNavDocument;

NavigationList tables = NavTablesFromManifestItem(sharedMe, tocItem);
for (auto& table : tables)
{
// have to dynamic_cast these guys to get the right pointer type
NavigationTablePtr navTable = NavigationTable::CastFrom<NavigationElement>(table);
if (!tocNames.empty()) {
try
{
ManifestItemPtr tocItem = ManifestItemWithID(tocNames[0]);
if (!bool(tocItem))
throw EPUBError::OPFNoNavDocument;

NavigationList tables = NavTablesFromManifestItem(sharedMe, tocItem);
for (auto& table : tables)
{
// have to dynamic_cast these guys to get the right pointer type
NavigationTablePtr navTable = NavigationTable::CastFrom<NavigationElement>(table);
#if EPUB_HAVE(CXX_MAP_EMPLACE)
_navigation.emplace(navTable->Type(), navTable);
_navigation.emplace(navTable->Type(), navTable);
#else
_navigation[navTable->Type()] = navTable;
_navigation[navTable->Type()] = navTable;
#endif
}
}
catch (std::exception& exc)
{
std::cerr << "Exception locating or processing NCX navigation document: " << exc.what() << std::endl;
throw;
}
catch (EPUBError errCode)
{
// a 'break'-style mechanism here
// the error handler will determine if it's safe to continue
HandleError(errCode);
}
catch (...)
{
HandleError(EPUBError::OPFNoNavDocument);
}
}
}
catch (std::exception& exc)
{
std::cerr << "Exception locating or processing NCX navigation document: " << exc.what() << std::endl;
throw;
}
catch (EPUBError errCode)
{
// a 'break'-style mechanism here
// the error handler will determine if it's safe to continue
HandleError(errCode);
}
catch (...)
{
HandleError(EPUBError::OPFNoNavDocument);
}
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion ePub3/ePub/property_holder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ PropertyPtr PropertyHolder::PropertyMatching(const string& reference, const stri
{
IRI iri = MakePropertyIRI(reference, prefix);
if ( iri.IsEmpty() )
return false;
return nullptr;
return PropertyMatching(iri, lookupParents);
}

Expand Down