Loop iteration failing at second iterattion x86 asm, using NASM

Objective: I intend to create a program that appended digits from user input, convert from ascii to number and into an array (intArray) and also get their sum all using a loop that iterates 5 times. I am very new to assembly language programming so I’m having a really difficult time debugging the program.

So far this is the code I’ve been able to come up with. It compiles and links successfully. After execution upon the second iteration, it fails with an error

Enter an integer: 49
Enter an integer: 50
zsh: segmentation fault out/solution

Please what I’m I doing wrong?
Thanks

section .bss
    input RESB 10 ; reserve 10 bytes for input

section .data
    list db 1,2,3,4,5
    prompt db "Enter an integer: ", 0
    prompt_len equ $ - prompt ; length of the prompt

    result_msg db "The sum is: ", 0
    result_msg_len equ $ - result_msg

    buffer db 12 dup(0)     ; buffer for input
    intArray dd 5 dup(0)
    arraySize db 0
    sum dd 0

section .text

global _start
_start:
    mov ecx, 5 ; loop 5 times

loop_prompt_handler:
    ; print the prompt to enter input
    mov eax, 4              ; sys_write
    mov ebx, 1              ; file descriptor 1 (stdout)
    mov ecx, prompt         ; message to print
    mov edx, prompt_len     ; number of bytes to read
    int 0x80

    ; read the input
    mov eax, 3              ; sys_read
    mov ebx, 0              ; file descriptor 0 (stdin)
    mov ecx, input          ; message to read
    mov edx, 10             ; number of bytes to read
    int 0x80

    ; convert ASCII input to integer
    call str_to_int

    ; append to array
    mov ebx, [arraySize]    ; load current size of the array
    mov edx, intArray       ; load address of the array
    add edx, ebx            ; point to the end of the array
    mov [edx], eax          ; store the input number at the end of the array

    ; increment array size
    inc byte [arraySize]    ; increment array size

    ; add the input number to the sum
    add dword [sum], eax

    loop loop_prompt_handler ; loop_prompt_handler label if ecx is not zero

    ; print the result
    mov eax, 4              ; sys_write
    mov ebx, 1              ; file descriptor 1 (stdout)
    mov ecx, result_msg     ; message to print
    mov edx, result_msg_len ; number of bytes to read
    int 0x80

    ; convert sum to string
    mov eax, [sum]
    mov ecx, buffer         ; buffer containing the sum as a string
    call int_to_string

    ; print the sum
    mov eax, 4              ; sys_write
    mov ebx, 1              ; file descriptor 1 (stdout)
    mov edx, 12             ; length of the buffer
    int 0x80

    ; exit
    mov eax, 1              ; sys_exit
    xor ebx, ebx            ; exit code
    int 0x80

str_to_int:
    ; ecx: pointer to input string
    ; eax: result
    xor eax, eax            ; clear eax
    xor edx, edx            ; clear edx

    str_to_int_loop:
        movzx edx, byte [ecx]
        test dl, dl
        jz str_to_int_end
        sub dl, '0'
        imul eax, eax, 10
        add eax, edx
        inc ecx
        jmp str_to_int_loop
    
    str_to_int_end:
        ret

int_to_string:
    ; eax contains the string to convert
    ; ecx points to the buffer to store the string
    mov edi, ecx
    add edi, 11
    mov byte [edi], 0
    dec edi

    .convert_loop:
        xor edx, edx
        mov ebx, 10
        div ebx
        add dl, '0'
        mov [edi], dl
        dec edi
        test eax, eax
        jnz .convert_loop

    inc edi
    mov ecx, edi
    ret

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật