GithubHelp home page GithubHelp logo

Comments (8)

fanfeilong avatar fanfeilong commented on June 24, 2024 1

@cmyr @vlovich The files I am trying to open are in my local project. It seems that any file in this folder will crash. I have tar the test source files and crash report file with tar cvzf:
crash_report.tar.gz

from xi-mac.

cmyr avatar cmyr commented on June 24, 2024

Strange. Some more information would be useful:

  • Are there any relevant crash reports in ~/Library/Logs/DiagnosticReports?
  • Did you build from the command line with xcodebuild, or via Xcode.app?
  • Other files are working fine?

from xi-mac.

vlovich avatar vlovich commented on June 24, 2024

Also can you attach the file or provide a URL? I grabbed https://raw.githubusercontent.com/xamarin/sqlite/master/dist/sqlite3.c & it opened without issue for me.

from xi-mac.

vlovich avatar vlovich commented on June 24, 2024

func utf8_offset_to_utf16(_ s: String, _ ix: Int) -> Int {
return s.utf8.index(s.utf8.startIndex, offsetBy: ix).encodedOffset
}

Precondition failed: file /BuildRoot/Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-900.0.74.1/src/swift/stdlib/public/core/StringUTF8.swift, line 185
2018-01-31 20:23:56.660028-0800 XiEditor[54308:17000757] Precondition failed: file /BuildRoot/Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-900.0.74.1/src/swift/stdlib/public/core/StringUTF8.swift, line 185

po s.count
80

ix 83

Looks like an out of bounds issue of some kind I think.

from xi-mac.

vlovich avatar vlovich commented on June 24, 2024

#3 0x00000001000315ad in utf8_offset_to_utf16(::) at /Users/vlovich/src/xi-mac/XiEditor/StyleMap.swift:105
#4 0x0000000100030fcc in static StyleSpan.styles(fromRaw:text:) at /Users/vlovich/src/xi-mac/XiEditor/StyleMap.swift:91
#5 0x000000010003f4e6 in Line.init(fromJson:) at /Users/vlovich/src/xi-mac/XiEditor/LineCache.swift:44
#6 0x0000000100044f28 in LineCacheState.applyUpdate(update:) at /Users/vlovich/src/xi-mac/XiEditor/LineCache.swift:148
#7 0x000000010004be5b in LineCacheLocked.applyUpdate(update:) at /Users/vlovich/src/xi-mac/XiEditor/LineCache.swift:326

from xi-mac.

vlovich avatar vlovich commented on June 24, 2024

StyleSpan.styles:
(lldb) po text.count
80

(lldb) po start
3

(lldb) po end
83

(lldb) po style
2

from xi-mac.

cmyr avatar cmyr commented on June 24, 2024

okay, this is because we aren't correctly handling the BOM. Adding the BOM to an otherwise okay file results in the same crash.

This highlights some general laxness we have around handling character encoding.

from xi-mac.

cmyr avatar cmyr commented on June 24, 2024

fixed in xi-editor/xi-editor#513

from xi-mac.

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.