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
This commit is contained in:
Kirill Lipatov (Leency) 2020-12-11 03:05:01 +00:00
parent 7c5089302e
commit 5d3b2a031a
3 changed files with 8 additions and 2 deletions

View File

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

View File

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

View File

@ -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]