Skip to content

Avoid crash if the document has errors #246

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ryuukk
Copy link
Contributor

@ryuukk ryuukk commented Jul 2, 2022

I got hit by this error

std.utf.UTFException@\/usr\/include\/dlang\/ldc\/std\/utf.d(1547): Invalid UTF-8 sequence (at index 1)\n----------------\n\/usr\/include\/dlang\/ldc\/std\/utf.d:1585 pure dchar std.utf.decodeImpl!(true, 0, const(char)[]).decodeImpl(ref const(char)[], ref ulong) [0x560d91cf050e]\n\/usr\/include\/dlang\/ldc\/std\/utf.d:1186 pure @trusted dchar std.utf.decode!(0, const(char)[]).decode(scope ref const(char)[], ref ulong) [0x560d91cf0429]\n\/usr\/include\/dlang\/ldc\/std\/range\/primitives.d:2504 pure @property @safe dchar std.range.primitives.front!(char).front(scope const(char)[]) [0x560d91cfdbcb]\n\/usr\/include\/dlang\/ldc\/std\/algorithm\/searching.d:2718 [0x560d9223703f]\n\/usr\/include\/dlang\/ldc\/std\/string.d:1645 [0x560d92273a92]\n\/usr\/include\/dlang\/ldc\/std\/string.d:1770 [0x560d922739df]\n..\/..\/.dub\/packages\/libdparse-0.19.0\/libdparse\/src\/dparse\/strings.d:665 [0x560d92272b53]\n..\/..\/.dub\/packages\/libdparse-0.19.0\/libdparse\/src\/dparse\/strings.d:262 [0x560d9209daf4]\n..\/..\/.dub\/packages\/workspace-d-3.8.0\/workspace-d\/source\/workspaced\/dparseext.d:312 [0x560d9209ce93]\n..\/..\/.dub\/packages\/workspace-d-3.8.0\/workspace-d\/source\/workspaced\/com\/dcdext.d:949 [0x560d91ff855d]\nsource\/served\/commands\/highlight.d:63 [0x560d91d40997]\nsource\/served\/commands\/highlight.d:46 [0x560d91c877f1]\nserverbase\/source\/served\/serverbase.d:198 [0x560d91c9b34d]\nserverbase\/source\/served\/utils\/events.d:232 [0x560d91c9ab4a]\nserverbase\/source\/served\/utils\/events.d:297 [0x560d91c8b081]\nserverbase\/source\/served\/utils\/events.d:206 [0x560d91c6aeb7]\nserverbase\/source\/served\/serverbase.d:171 [0x560d91c69d71]\nserverbase\/source\/served\/serverbase.d:306 [0x560d91c6b48c]\n??:? fiber_entryPoint [0x7f0bd538b5ba]

@WebFreak001
Copy link
Member

should we catch Exception in general?

It might also throw ConvException: https://github.com/dlang-community/libdparse/blob/6f0893f6b07ec561d382f26c81e74f7788056828/src/dparse/strings.d#L223

@karbiv
Copy link

karbiv commented Mar 22, 2025

This fatal error is not present in current version 0.8.0, so it's fixed.

Version 0.7.6 crashes with "Invalid UTF-8 sequence" when opening a file in std library. (typecons.d)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants