From 3e353c07a5c3d5f6c22062adf684cea59c0e86a3 Mon Sep 17 00:00:00 2001 From: bptato Date: Sat, 22 Jun 2024 18:02:31 +0200 Subject: pager: fix nil deref in dupeBuffer --- src/local/pager.nim | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/local/pager.nim b/src/local/pager.nim index 411ef1b1..5a3f84eb 100644 --- a/src/local/pager.nim +++ b/src/local/pager.nim @@ -8,6 +8,7 @@ import std/selectors import std/tables import std/unicode +import chagashi/charset import config/chapath import config/config import config/mailcap @@ -50,8 +51,6 @@ import utils/regexutils import utils/strwidth import utils/twtstr -import chagashi/charset - type LineMode* = enum lmLocation = "URL: " @@ -688,19 +687,23 @@ func findProcMapItem*(pager: Pager; pid: int): int = -1 proc dupeBuffer(pager: Pager; container: Container; url: URL) = - container.clone(url, pager.loader).then(proc(container: Container) = - if container == nil: - pager.alert("Failed to duplicate buffer.") - else: - pager.addContainer(container) - pager.procmap.add(ProcMapItem( - container: container, - fdin: -1, - fdout: -1, - istreamOutputId: -1, - ostreamOutputId: -1 - )) - ) + let p = container.clone(url, pager.loader) + if p == nil: + pager.alert("Failed to duplicate buffer.") + else: + p.then(proc(container: Container) = + if container == nil: + pager.alert("Failed to duplicate buffer.") + else: + pager.addContainer(container) + pager.procmap.add(ProcMapItem( + container: container, + fdin: -1, + fdout: -1, + istreamOutputId: -1, + ostreamOutputId: -1 + )) + ) proc dupeBuffer(pager: Pager) {.jsfunc.} = pager.dupeBuffer(pager.container, pager.container.url) -- cgit 1.4.1-2-gfad0 ls/iso/kernel.soso/gdt.asm?h=main&id=0518944e379f343542c872a20d3d5a2aee744297'>diff stats
path: root/tools/iso/kernel.soso/gdt.asm
blob: 54c01cfa6b0c215b8d8b968baeb9174355abb0aa (plain) (tree)





























                                                                                                                    
[GLOBAL flushGdt]

flushGdt:
    mov eax, [esp+4] ;[esp+4] is the parametered passed
    lgdt [eax]

    mov ax, 0x10  ;0x10 is the offset to our data segment
    mov ds, ax
    mov es, ax
    mov fs, ax
    mov gs, ax
    mov ss, ax
    jmp 0x08:.flush ;0x08 is the offset to our code segment
.flush:
    ret

[GLOBAL flushIdt]

flushIdt:
    mov eax, [esp+4] ;[esp+4] is the parametered passed
    lidt [eax]
    ret

[GLOBAL flushTss]

flushTss:
    mov ax, 0x2B ;index of the TSS structure is 0x28 (5*8) and OR'ing two bits in order to set RPL 3 and we get 0x2B

    ltr ax
    ret