Skip to content

Sora Editor crashes when opening or editing binary files with null bytes and invalid text characters. #863

Description

@JulyAsif

When a binary file is opened in Sora Editor, the editor may behave incorrectly and crash when attempting to edit the file. Binary data is interpreted as normal text, causing syntax highlighting and text processing to behave unexpectedly.

The issue is especially reproducible with files containing binary characters, including "NULL" bytes ("0x00"). Large binary files also trigger the same problem. The editor either becomes unstable, displays corrupted text behavior, or crashes directly during editing operations.

Steps to Reproduce

  1. Create or obtain a binary file containing non-text bytes.
  2. Open the binary file in Sora Editor.
  3. Try to place the cursor, type, delete, or modify the content.
  4. Observe that:
    • Syntax highlighting behaves incorrectly.
    • Text rendering becomes corrupted.
    • Editing operations cause unexpected behavior.
    • The editor eventually crashes.

Another way to reproduce:

  1. Copy and paste a large amount of binary data containing "NULL" bytes and other non-printable characters into an editor buffer.
  2. Try editing the pasted content.
  3. The editor crashes.

Expected Behavior

  • The editor should detect binary content and handle it safely.
  • Binary files should either:
    • Open in a read-only hexadecimal/binary view, or
    • Show a warning that the file is not a text file.
  • The editor should never crash regardless of file content.

Actual Behavior

  • Binary data is processed as normal text.
  • Null bytes and invalid characters break editor internal processing.
  • Syntax highlighting behaves abnormally.
  • Editing binary content causes a crash.

Additional Information

  • The problem occurs with both existing binary files and manually generated large binary files.
  • The crash appears related to handling of:
    • "NULL" bytes ("\0")
    • Non-printable characters
    • Large binary buffers
    • Text analysis/syntax highlighting on invalid UTF data

Suggested Fix

  • Add binary file detection before loading content into the text editor.
  • Detect high percentage of non-printable characters or null bytes.
  • Disable syntax highlighting and text processing for binary files.
  • Add proper bounds and character validation inside editor operations.
  • Prevent invalid UTF-8/binary data from reaching text parsing components.

Severity

High — The issue causes application crashes and prevents safe handling of arbitrary files.

screen-20260717-173938.mp4

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions