Page 1 of 1

FIX for 149 bug "unstable IRCC" - please merge this patch to SVN

Posted: Sat Feb 17, 2024 5:48 pm
by floppy121
As you could see by this bug - https://bugs.kolibrios.org/view.php?id=149 (0000149: IRCC becomes unstable with 0.34 version (r9091 --> r9092)) :

IRCC freezes when trying to print the unsupported characters such as BOLD code 0x02, which could be i.e. a part of MOTD ("Message of the Day") that is sent to you by IRC server when you join it. I investigated this further, IRCC freezes when receiving any of these chars (decimal codes) :

Code: Select all

1 , 2 , 4 , 5 , 6 , 7 , 8 , 9 , 11 , 12
As a temporary solution, I came up with this patch (see the attached file, could be merged with "patch -p1 < ./kolibrios_r9976_ircc-fix-chars.patch" command on Linux) - to ensure that IRC does not try to print any of these "bad characters". Please review and merge it to KolibriOS SVN

Re: FIX for 149 bug "unstable IRCC" - please merge this patch to SVN

Posted: Sun Feb 18, 2024 9:45 pm
by hidnplayr
Aha, good that you sent a reminder!
It seems quite obvious to me today that if there are two non-printable characters in a row, code is stuck in an endless loop here:

Code: Select all

;-------------------------------------------
; Count characters until 0, 10, 13 or 3 byte

        push    edx
        xor     esi, esi
        dec     esi
  .next_char:
        inc     esi
        cmp     esi, [textbox_width]
        je      .cnt_done
        mov     al, byte[edx]
        cmp     al, 13
        jbe     .cnt_done

        inc     edx
        test    al, 10000000b
        jz      .next_char              ; 1 byte wide

        add     edx, 3
        and     al, 11111000b
        cmp     al, 11110000b
        je      .next_char              ; 4 bytes wide

        dec     edx
        and     al, 11110000b
        cmp     al, 11100000b
        je      .next_char              ; 3 bytes wide
        dec     edx                     ; 2 bytes wide
        jmp     .next_char
  .cnt_done:
        mov     eax, edx
        pop     edx
        push    eax
        mcall   4                       ; draw text
        pop     edx                     ; next start ptr
        

Re: FIX for 149 bug "unstable IRCC" - please merge this patch to SVN

Posted: Sun Feb 18, 2024 9:49 pm
by hidnplayr
Please try like this instead:

(inc edx moved up)

Code: Select all

;-------------------------------------------
; Count characters until 0, 10, 13 or 3 byte

        push    edx
        xor     esi, esi
        dec     esi
  .next_char:
        inc     esi
        cmp     esi, [textbox_width]
        je      .cnt_done
        mov     al, byte[edx]
        
        inc     edx
                
        cmp     al, 13
        jbe     .cnt_done

        test    al, 10000000b
        jz      .next_char              ; 1 byte wide

        add     edx, 3
        and     al, 11111000b
        cmp     al, 11110000b
        je      .next_char              ; 4 bytes wide

        dec     edx
        and     al, 11110000b
        cmp     al, 11100000b
        je      .next_char              ; 3 bytes wide
        dec     edx                     ; 2 bytes wide
        jmp     .next_char
  .cnt_done:
        mov     eax, edx
        pop     edx
        push    eax
        mcall   4                       ; draw text
        pop     edx                     ; next start ptr

Re: FIX for 149 bug "unstable IRCC" - please merge this patch to SVN

Posted: Sun Feb 18, 2024 11:12 pm
by floppy121
hidnplayr wrote: Sun Feb 18, 2024 9:49 pmPlease try like this instead:
Thank you so much for coming! :D Unfortunately, with this change - regardless of whether my "fix" patch above is applied - IRCC crashes at launch: the program's window instantly disappears after appearing. To reproduce this quickly - you may use my new Vigenere floppy from this post: http://board.kolibrios.org/viewtopic.php?p=80204#p80204 (this Vigenere patch touches only 4 files and doesn't change textbox.inc, so the experience should be the same). This floppy has the modified source code of IRCC with all the external dependencies included, so after unpacking the /sys/Ircc/ircc_r9977_vigenere.7z you can just double-click IRCC.ASM to open it in Tinypad and then Run

P.S. sorry that it takes me so long to reply to your e-mail :oops: , really wanted to update my IRCC mod before replying

Re: FIX for 149 bug "unstable IRCC" - please merge this patch to SVN

Posted: Mon Feb 19, 2024 11:41 pm
by hidnplayr
Actually works on my computer this time :)
ircc.7z (29.85 KiB)
Downloaded 137 times

Re: FIX for 149 bug "unstable IRCC" - please merge this patch to SVN

Posted: Thu Feb 22, 2024 10:16 pm
by floppy121
hidnplayr wrote: Mon Feb 19, 2024 11:41 pmActually works on my computer this time :)
Thank you, it works fine for me too now ;-) Btw it seems that only 7z archives packed with -m0=Deflate are supported in Kolibri

Re: FIX for 149 bug "unstable IRCC" - please merge this patch to SVN

Posted: Fri Feb 23, 2024 7:58 pm
by hidnplayr
Committed in #9978