From 4edab116163a199dd5e4a330206b76e37018cffe Mon Sep 17 00:00:00 2001 From: Green Sky Date: Sat, 19 Aug 2023 21:42:47 +0200 Subject: [PATCH] update deps and dont try to load files >50mib as images --- external/solanaceae_message3 | 2 +- external/solanaceae_tox | 2 +- external/solanaceae_toxcore | 2 +- src/main_screen.cpp | 2 ++ src/media_meta_info_loader.cpp | 10 ++++++++++ 5 files changed, 15 insertions(+), 3 deletions(-) diff --git a/external/solanaceae_message3 b/external/solanaceae_message3 index d2d6cfbf..53d65a06 160000 --- a/external/solanaceae_message3 +++ b/external/solanaceae_message3 @@ -1 +1 @@ -Subproject commit d2d6cfbf5326de74cbac2dcd11be74df2cf79d2a +Subproject commit 53d65a06855129135e5884f50d9983676290ac24 diff --git a/external/solanaceae_tox b/external/solanaceae_tox index 70a234cd..dd596bda 160000 --- a/external/solanaceae_tox +++ b/external/solanaceae_tox @@ -1 +1 @@ -Subproject commit 70a234cdae751141f48b7a53a4e1cbedd84f31b2 +Subproject commit dd596bdad8d71654ff21dd3a032d6eb2dd7139a8 diff --git a/external/solanaceae_toxcore b/external/solanaceae_toxcore index b49db892..dfa5a501 160000 --- a/external/solanaceae_toxcore +++ b/external/solanaceae_toxcore @@ -1 +1 @@ -Subproject commit b49db892f6f0069985c763f7c8598b57fc9810dd +Subproject commit dfa5a501ec4b4d929f473dabd51fa39bc0550266 diff --git a/src/main_screen.cpp b/src/main_screen.cpp index fcb26558..8ed75df8 100644 --- a/src/main_screen.cpp +++ b/src/main_screen.cpp @@ -76,6 +76,8 @@ Screen* MainScreen::poll(bool& quit) { quit = !tc.iterate(); + tcm.iterate(time_delta); + pm.tick(time_delta); mts.iterate(); diff --git a/src/media_meta_info_loader.cpp b/src/media_meta_info_loader.cpp index 5f6838cf..d156fe7a 100644 --- a/src/media_meta_info_loader.cpp +++ b/src/media_meta_info_loader.cpp @@ -25,6 +25,15 @@ void MediaMetaInfoLoader::handleMessage(const Message3Handle& m) { std::ifstream file(fil.file_list.front(), std::ios::binary); if (file.is_open()) { + // figure out size + file.seekg(0, file.end); + if (file.tellg() > 50*1024*1024) { + // TODO: conf + // dont try load files larger 50mb + return; + } + file.seekg(0, file.beg); + std::vector tmp_buffer; while (file.good()) { auto ch = file.get(); @@ -38,6 +47,7 @@ void MediaMetaInfoLoader::handleMessage(const Message3Handle& m) { bool could_load {false}; // try all loaders after another for (auto& il : _image_loaders) { + // TODO: impl callback based load auto res = il->loadInfoFromMemory(tmp_buffer.data(), tmp_buffer.size()); if (res.height == 0 || res.width == 0) { continue;