From 5c194bbe107e12b47823a5c86d666515aaa2b8dc Mon Sep 17 00:00:00 2001 From: "Evgeny Grechnikov (Diamond)" Date: Sun, 2 Nov 2008 11:44:00 +0000 Subject: [PATCH] kfar_arc: bugfix in loading of 7z archives git-svn-id: svn://kolibrios.org@893 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/fs/kfar/trunk/kfar_arc/7z.inc | 2 +- programs/fs/kfar/trunk/kfar_arc/kfar_arc.asm | 4 +-- programs/fs/kfar/trunk/kfar_arc/lzma.inc | 26 +++++++++++++++----- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/programs/fs/kfar/trunk/kfar_arc/7z.inc b/programs/fs/kfar/trunk/kfar_arc/7z.inc index 536ee93141..01e46dbba4 100644 --- a/programs/fs/kfar/trunk/kfar_arc/7z.inc +++ b/programs/fs/kfar/trunk/kfar_arc/7z.inc @@ -1834,7 +1834,7 @@ _7z.decode: mov esi, [.pStreams] mov eax, [esi+eax*4] call fillBuf - mov ecx, [eax+streamInfo.bufSize] + mov ecx, [eax+streamInfo.bufDataLen] mov esi, [eax+streamInfo.bufPtr] mov edi, [.outBufferPtr] add edi, [.outBufferRead] diff --git a/programs/fs/kfar/trunk/kfar_arc/kfar_arc.asm b/programs/fs/kfar/trunk/kfar_arc/kfar_arc.asm index f85dfd4afe..6cefc56747 100644 --- a/programs/fs/kfar/trunk/kfar_arc/kfar_arc.asm +++ b/programs/fs/kfar/trunk/kfar_arc/kfar_arc.asm @@ -2,8 +2,8 @@ ; project name: KFar_Arc - plugin for KFar, which supports various archives ; target platform: KolibriOS ; compiler: FASM 1.67.14 -; version: 0.12 -; last update: 2007-10-06 (Oct 06, 2007) +; version: 0.13 +; last update: 2008-11-02 (Nov 02, 2008) ; minimal KFar version: 0.41 ; minimal kernel: no limit ; diff --git a/programs/fs/kfar/trunk/kfar_arc/lzma.inc b/programs/fs/kfar/trunk/kfar_arc/lzma.inc index e3f822180b..2410870f19 100644 --- a/programs/fs/kfar/trunk/kfar_arc/lzma.inc +++ b/programs/fs/kfar/trunk/kfar_arc/lzma.inc @@ -132,14 +132,22 @@ end virtual lea eax, [ebp + eax + .p+.Literal*4] cmp ebx, .kNumLitStates jb .literal - xor edx, edx + mov edx, edi sub edx, [ebp+.rep0] - mov dl, [edi + edx] + cmp edx, [ebp+streamInfo.bufPtr] + jb .before_buf +@@: + mov dl, [edx] call .LzmaLiteralDecodeMatch - jmp @f + jmp .got_byte +.before_buf: + add edx, [ebp+streamInfo.bufSize] + cmp edx, [ebp+streamInfo.bufPtr] + jb return.err + jmp @b .literal: call .LzmaLiteralDecode -@@: +.got_byte: mov [ebp+.previousByte], al stosb mov al, bl @@ -167,9 +175,15 @@ end virtual cmp bl, 7 setae bl lea ebx, [9 + ebx + ebx] - xor edx, edx + mov edx, edi sub edx, [ebp+.rep0] - mov al, [edi + edx] + cmp edx, [ebp+streamInfo.bufPtr] + jae @f + add edx, [ebp+streamInfo.bufSize] + cmp edx, [ebp+streamInfo.bufPtr] + jb return.err +@@: + mov al, [edx] stosb mov [ebp+.previousByte], al jmp .main_loop