update deps and dont try to load files >50mib as images

This commit is contained in:
Green Sky 2023-08-19 21:42:47 +02:00
parent 6df0417667
commit 4edab11616
No known key found for this signature in database
5 changed files with 15 additions and 3 deletions

@ -1 +1 @@
Subproject commit d2d6cfbf5326de74cbac2dcd11be74df2cf79d2a
Subproject commit 53d65a06855129135e5884f50d9983676290ac24

@ -1 +1 @@
Subproject commit 70a234cdae751141f48b7a53a4e1cbedd84f31b2
Subproject commit dd596bdad8d71654ff21dd3a032d6eb2dd7139a8

@ -1 +1 @@
Subproject commit b49db892f6f0069985c763f7c8598b57fc9810dd
Subproject commit dfa5a501ec4b4d929f473dabd51fa39bc0550266

View File

@ -76,6 +76,8 @@ Screen* MainScreen::poll(bool& quit) {
quit = !tc.iterate();
tcm.iterate(time_delta);
pm.tick(time_delta);
mts.iterate();

View File

@ -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<uint8_t> 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;