dont load svg

This commit is contained in:
Green Sky
2026-01-10 13:09:41 +01:00
parent 22823c5ca2
commit bf55561193
3 changed files with 33 additions and 32 deletions

View File

@@ -31,13 +31,13 @@ if (TOMATO_ASAN)
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
if (NOT WIN32) # exclude mingw if (NOT WIN32) # exclude mingw
add_compile_options(-fno-omit-frame-pointer) add_compile_options(-fno-omit-frame-pointer)
add_compile_options(-fsanitize=address,undefined) add_compile_options(-fsanitize=address,undefined,nullability)
#add_compile_options(-fsanitize=address,undefined,pointer-compare,pointer-subtract) #add_compile_options(-fsanitize=address,undefined,pointer-compare,pointer-subtract)
#add_compile_options(-fhardened) #add_compile_options(-fhardened)
#add_compile_options(-D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS -ftrivial-auto-var-init=zero -fPIE -pie -Wl,-z,relro,-z,now -fstack-protector-strong -fstack-clash-protection -fcf-protection=full) #add_compile_options(-D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS -ftrivial-auto-var-init=zero -fPIE -pie -Wl,-z,relro,-z,now -fstack-protector-strong -fstack-clash-protection -fcf-protection=full)
add_link_options(-fno-omit-frame-pointer) add_link_options(-fno-omit-frame-pointer)
add_link_options(-fsanitize=address,undefined) add_link_options(-fsanitize=address,undefined,nullability)
#add_link_options(-fsanitize=address,undefined,pointer-compare,pointer-subtract) #add_link_options(-fsanitize=address,undefined,pointer-compare,pointer-subtract)
#add_link_options(-fhardened) #add_link_options(-fhardened)
#add_link_options(-D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS -ftrivial-auto-var-init=zero -fPIE -pie -Wl,-z,relro,-z,now -fstack-protector-strong -fstack-clash-protection -fcf-protection=full) #add_link_options(-D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS -ftrivial-auto-var-init=zero -fPIE -pie -Wl,-z,relro,-z,now -fstack-protector-strong -fstack-clash-protection -fcf-protection=full)
@@ -99,34 +99,34 @@ set(TOMATO_GIT_COMMIT "UNK")
find_package(Git QUIET) find_package(Git QUIET)
if(NOT Git_FOUND) if(NOT Git_FOUND)
find_program(GIT_EXECUTABLE NAMES git git.exe) find_program(GIT_EXECUTABLE NAMES git git.exe)
if(GIT_EXECUTABLE) if(GIT_EXECUTABLE)
set(Git_FOUND TRUE) set(Git_FOUND TRUE)
message(STATUS "Found Git: ${GIT_EXECUTABLE}") message(STATUS "Found Git: ${GIT_EXECUTABLE}")
endif() endif()
endif() endif()
if(Git_FOUND) if(Git_FOUND)
execute_process( execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_HEAD OUTPUT_VARIABLE GIT_HEAD
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE RES RESULT_VARIABLE RES
) )
if (RES EQUAL 0) if (RES EQUAL 0)
set(TOMATO_GIT_COMMIT ${GIT_HEAD}) set(TOMATO_GIT_COMMIT ${GIT_HEAD})
endif() endif()
execute_process( execute_process(
COMMAND ${GIT_EXECUTABLE} rev-list --count HEAD COMMAND ${GIT_EXECUTABLE} rev-list --count HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_DEPTH OUTPUT_VARIABLE GIT_DEPTH
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE RES RESULT_VARIABLE RES
) )
if (RES EQUAL 0) if (RES EQUAL 0)
set(TOMATO_GIT_DEPTH ${GIT_DEPTH}) set(TOMATO_GIT_DEPTH ${GIT_DEPTH})
endif() endif()
endif() endif()
message(STATUS "tomato version: ") message(STATUS "tomato version: ")

View File

@@ -7,6 +7,7 @@
static std::optional<const char*> getExt(SDL_IOStream* ios) { static std::optional<const char*> getExt(SDL_IOStream* ios) {
// blacklist: // blacklist:
// - svg
// - tga // - tga
// - tiff // - tiff
// - xcf // - xcf
@@ -33,8 +34,6 @@ static std::optional<const char*> getExt(SDL_IOStream* ios) {
return "png"; return "png";
} else if (IMG_isPNM(ios)) { } else if (IMG_isPNM(ios)) {
return "pnm"; return "pnm";
} else if (IMG_isSVG(ios)) {
return "svg";
} else if (IMG_isXPM(ios)) { } else if (IMG_isXPM(ios)) {
return "xpm"; return "xpm";
} else if (IMG_isXV(ios)) { } else if (IMG_isXV(ios)) {

View File

@@ -50,11 +50,19 @@ void MediaMetaInfoLoader::handleMessage(const Message3Handle& m) {
return; return;
} }
if (!o.all_of<ObjComp::F::TagLocalHaveAll>()) {
// not ready yet
return;
}
// TODO: handle collections // TODO: handle collections
const auto file_size = o.get<ObjComp::F::SingleInfo>().file_size; const auto file_size = o.get<ObjComp::F::SingleInfo>().file_size;
if (file_size > 50*1024*1024) { if (file_size > 50*1024*1024) {
std::cerr << "MMIL error: image file too large\n"; // not an error
//std::cerr << "MMIL error: image file too large\n";
// this is unlikely to change, so we tag as not image
m.emplace<Message::Components::TagNotImage>();
return; return;
} }
@@ -63,18 +71,12 @@ void MediaMetaInfoLoader::handleMessage(const Message3Handle& m) {
return; return;
} }
if (!o.all_of<ObjComp::F::TagLocalHaveAll>()) {
// not ready yet
return;
}
auto* file_backend = o.get<ObjComp::Ephemeral::BackendFile2>().ptr; auto* file_backend = o.get<ObjComp::Ephemeral::BackendFile2>().ptr;
if (file_backend == nullptr) { if (file_backend == nullptr) {
std::cerr << "MMIL error: object backend nullptr\n"; std::cerr << "MMIL error: object backend nullptr\n";
return; return;
} }
auto file2 = file_backend->file2(o, StorageBackendIFile2::FILE2_READ); auto file2 = file_backend->file2(o, StorageBackendIFile2::FILE2_READ);
if (!file2 || !file2->isGood() || !file2->can_read) { if (!file2 || !file2->isGood() || !file2->can_read) {
std::cerr << "MMIL error: creating file2 from object via backendI\n"; std::cerr << "MMIL error: creating file2 from object via backendI\n";