From 5d3b2a031a340f4641b781bb92d4ed67069e8686 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Fri, 11 Dec 2020 03:05:01 +0000 Subject: [PATCH] libimg: img.decode now checks that length is not null WebView: img tag: proceed data-src= if src= is empty, fix crash git-svn-id: svn://kolibrios.org@8363 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/browser/TWB/TWB.c | 3 ++- programs/cmm/browser/WebView.c | 2 +- programs/develop/libraries/libs-dev/libimg/libimg.asm | 5 +++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/programs/cmm/browser/TWB/TWB.c b/programs/cmm/browser/TWB/TWB.c index e3dfaf4504..9359eb33db 100644 --- a/programs/cmm/browser/TWB/TWB.c +++ b/programs/cmm/browser/TWB/TWB.c @@ -452,13 +452,14 @@ void TWebBrowser::SetStyle() { } if (tag.is("img")) { value = tag.get_value_of("src="); + if (!value) value = tag.get_value_of("data-src="); if (!value) goto NOIMG; strlcpy(#img_path, value, sizeof(img_path)-1); get_absolute_url(#img_path, history.current()); //if (check_is_the_adress_local(#img_path)) <== load local files - if (cache.has(#img_path)) + if (cache.has(#img_path)) && (cache.current_size) { img_decode stdcall (cache.current_buf, cache.current_size, 0); if (!EAX) goto NOIMG; diff --git a/programs/cmm/browser/WebView.c b/programs/cmm/browser/WebView.c index d81553d129..8443cd4a92 100644 --- a/programs/cmm/browser/WebView.c +++ b/programs/cmm/browser/WebView.c @@ -42,7 +42,7 @@ // DATA // // // //===================================================// -char version[]="WebView 2.8 BETA 4"; +char version[]="WebView 2.8 BETA 5"; #define DEFAULT_URL URL_SERVICE_HOMEPAGE diff --git a/programs/develop/libraries/libs-dev/libimg/libimg.asm b/programs/develop/libraries/libs-dev/libimg/libimg.asm index a77c5bb1a0..baac0e375e 100644 --- a/programs/develop/libraries/libs-dev/libimg/libimg.asm +++ b/programs/develop/libraries/libs-dev/libimg/libimg.asm @@ -720,6 +720,9 @@ proc img.decode _data, _length, _options ;////////////////////////////////////// ;< eax = 0 / pointer to image ;; ;;================================================================================================;; push ebx + mov ebx, [_length] + or ebx,ebx + jz .fail mov ebx, img.formats_table @@: stdcall [ebx + FormatsTableEntry.Is], [_data], [_length] or eax, eax @@ -727,6 +730,8 @@ proc img.decode _data, _length, _options ;////////////////////////////////////// add ebx, sizeof.FormatsTableEntry cmp dword[ebx], eax ;0 jnz @b + .fail: + xor eax, eax pop ebx ret @@: mov eax, [ebx + FormatsTableEntry.Decode]