Git Product home page Git Product logo

Comments (4)

marvinhagemeister avatar marvinhagemeister commented on July 21, 2024 2

Deno should never panic, so yes.

from deno.

MujahedSafaa avatar MujahedSafaa commented on July 21, 2024

Hello @marvinhagemeister
Could you please confirm if the issue should be resolved by allowing non-ASCII characters?

from deno.

MujahedSafaa avatar MujahedSafaa commented on July 21, 2024

Hi @marvinhagemeister,

I've investigated this issue and found that in the code snippet that I attached below is attempting to extract a substring from self.text_str() based on the start and end positions specified in a SourceRange. The panic occurs because the code is slicing the string at byte indices that are not valid UTF-8 character boundaries. In Rust, strings are UTF-8 encoded, and incorrect slicing can cause panics. This issue originates from the Rust external library dprint-swc-ext-0.16.0.
image

My suggestions are as follows:

Replace the range_text Method:
The problematic code is being called from the deno-ast repository inside the diagnostics.rs file. I suggest replacing the range_text method with a new method that correctly handles non-ASCII characters.
image

Or Add Error Messages:
Introduce error messages indicating that non-ASCII characters are not supported to prevent Deno from panicking.

Please let me know if you have any other ideas or suggestions.

from deno.

marvinhagemeister avatar marvinhagemeister commented on July 21, 2024

looping in @dsherret who has more context on dprint.

from deno.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.