Live data from Hacker News

Picking Apart the Crashing iOS String

manishearth.github.io

101–110 of 182 posts

Re: Picking Apart the Crashing iOS String

#101

Earlier quoted context omitted.

I can answer your question for Devanagari: - You normally think of clusters as single "letters". The word for them in Marathi is "joined letter". This notion of "letter" may not be totally in line with what English speakers would expect. - You still think of clusters as having component parts that make it up. However, क्ष/ज्ञ and sometimes त्र are thought of as their own "fundamental" consonants even though they're c…

As someone who can read both Devanagari and English/Latin script, I'm just curious, when you read Devanagari does the text size need to be larger for good comprehension? There seems more subtlety with the word structure, like tiny little flicks which seem to have significant meaning. While Latin-like script has characters like the comma/full-stop, and modifiers like the dot on the i, these are far rarer than Devanaga…

How could anyone possibly consider this offensive?

Re: Picking Apart the Crashing iOS String

#102
post #38

Not directly related to the crash, but I have a question about Telugu and similar scripts: How do their speakers think about the structure of the script? Do they consider each vowel and consonant a separate "thing" that just happens to get written as a complex grapheme, or is the grapheme the unit you think about and it just happens to be made up of smaller parts? I.e https://en.wikipedia.org/wiki/Telugu_script#Conso…

An interesting debate that may be closer to home for English speakers: is ñ a letter? The Spanish alphabet considers it to be a different letter than n, but é is not a different letter than e. https://en.m.wikipedia.org/wiki/Ñ

Historically LL, CH, and RR have been considered separate Spanish letters, too. Since 1995, opinions diverge.

Re: Picking Apart the Crashing iOS String

#103

Earlier quoted context omitted.

I can answer your question for Devanagari: - You normally think of clusters as single "letters". The word for them in Marathi is "joined letter". This notion of "letter" may not be totally in line with what English speakers would expect. - You still think of clusters as having component parts that make it up. However, क्ष/ज्ञ and sometimes त्र are thought of as their own "fundamental" consonants even though they're c…

As someone who can read both Devanagari and English/Latin script, I'm just curious, when you read Devanagari does the text size need to be larger for good comprehension? There seems more subtlety with the word structure, like tiny little flicks which seem to have significant meaning. While Latin-like script has characters like the comma/full-stop, and modifiers like the dot on the i, these are far rarer than Devanaga…

Not really, I can read at normal text sizes. But it is somewhat annoying (much like how tiny English can be readable but annoying to read) and used to have my default font size bumped up by one in my browser. I currently have it bumped up quite a bit for Chinese because I really have trouble with the "tiny little flicks" problem in Chinese.

The consonants of Devanagari are easy to tell apart; they are pretty different. In most cases the "similar" ones are basically with an extra line (प/ष, ब/व) or with a little loop (य/थ, ट/ढ) . (The line/loop has no semantic meaning, these letters are just random letters that look similar) . The only super annoying one is घ vs ध -- the thing up top is a loop in the second one, but depending on the font/handwriting can be rather unclear.

The vowels are also easy to tell apart. There are 12 main ones, and they're made up from some really basic components which are quite distinguishable.

So you can easily distinguish consonant+vowel combos.

Consonant clusters can get tricky, like I said there are a bunch of ambiguous ones. Fortunately you end up realizing which is which and then it's nbd. But like, द्म and ह्म can be infuriatingly similar and you just get it from context.

Bear in mind, at one stage you start sight-reading words, so the actual details of the word matter less.

> Another related question is, because Devanagari's information density seems higher, does that mean shorter text for the equivalent information?

Visually? Yeah. Words can be really small. But it ends up roughly being the same number of code points (and probably more bytes in UTF-8).

Re: Picking Apart the Crashing iOS String

#104
post #60

Earlier quoted context omitted.

Use Hackintosh or a VM.

Given that Apple does not design their OS to work on anything but their hardware, the pain I would incur trying to set up either option is just not worth it. Unless someone has published a stable and updated pre-built VM for macOS, it just seems like nothing but trouble.

I was talking about those pre-built VMs.

Re: Picking Apart the Crashing iOS String

#105
post #43

Earlier quoted context omitted.

Latin text gives people a misleading idea as to how simple text is. For Latin, each character is generally an independent unit with independent metrics isolated from its environment, with a small set of exceptions to this rule (ligatures). East Asian ideographs bring up interesting questions about what constitutes a character, with Unicode "solving" the problem by saying "every distinct rendering is a distinct charac…

So far, if I understand correctly, nobody knows of a sequence of characters you could write down in any language that would trigger a crash when encoded in Unicode in a straightforward way. That suggests that the invariant being assumed may come, ironically, from a deep understanding of the scripts rather than ignorance.

No, the crashy Bengali sequences are reasonable to have; like I mentioned ZWNJ has semantic meaning with bengali vowels.

Re: Picking Apart the Crashing iOS String

#106

Earlier quoted context omitted.

Would that even be possible on iOS for non Apple employees? My idea would be just to create a program that continually creates Unicode strings and display them on screen with a pause before creating and displaying the next. Record the screen and see if any thing exciting happens. Would never end, if there was a SETI @ Home style program for it with insentives for running it would be cool.

> Would that even be possible on iOS for non Apple employees? iOS emulator (part of XCode) might be enough.

Simulator, not emulator. (There is a difference, and it is significant).

Re: Picking Apart the Crashing iOS String

#107
I cannot trigger this crash on iOS 10.3.2, despite repeated attempts. I can reliably crash friends' phones by iMessage for all friends on iOS 11.

That suggests to me that Apple made changes to CoreText, and did not perform adequate regression testing.

All software has bugs. I understand that. But I suspect a large part of power users' and developers' growing frustration with Apple is that they keep introducing severe, kernel-panicking, root-exposing bugs in software that previously did not exhibit the problematic behavior.

Honestly, how do you not have a stringent regression testing requirement for changes to the "Core" of the operating system?

Re: Picking Apart the Crashing iOS String

#108
post #88
post #79

Earlier quoted context omitted.

I wrote some similar bugs to this in the complex text handling in Chrome. In text layout you do a lot of indexing into various arrays -- like the array of code units of the input string, or an array of metadata collected per-code point, or an array of data collected per-grapheme. Oftentimes those arrays are all the same length (like in simple text like Chinese) and mixing up which index to use where is no problem. An…

> PS: If a web page wants to crash, it easily do so by allocating memory in a loop, isn't this also a bug :) And probably want we should fix.. I think all browsers are susceptible, though last I tried in Firefox one had to not just allocate but also fill the memory with garbage.

He means crash the single web page doing the loop... how would you fix this? Isn't the correct behavior when an application goes past resource limits to crash the app? It doesn't crash the browser or any other open tabs.

Re: Picking Apart the Crashing iOS String

#109
post #43

Earlier quoted context omitted.

Latin text gives people a misleading idea as to how simple text is. For Latin, each character is generally an independent unit with independent metrics isolated from its environment, with a small set of exceptions to this rule (ligatures). East Asian ideographs bring up interesting questions about what constitutes a character, with Unicode "solving" the problem by saying "every distinct rendering is a distinct charac…

So far, if I understand correctly, nobody knows of a sequence of characters you could write down in any language that would trigger a crash when encoded in Unicode in a straightforward way. That suggests that the invariant being assumed may come, ironically, from a deep understanding of the scripts rather than ignorance.

What do you mean by "straightforward" ?

Re: Picking Apart the Crashing iOS String

#110
post #67

Earlier quoted context omitted.

The crash seems to be in CoreText. CoreText is embedded/linked in Messages, Spotlight, Springboard, etc. CoreText is written in C. The fix would be to rewrite CoreText in a memory safe language like Swift. This would be “hard”. Or put CoreText in an XPC container. This would both be “hard” and result in terrible performance. For more details on how hard C, memory management, systems programming, and operating system…

There are usually less dramatic fixes like changing all the array accesses to be checked, or putting pages that will trigger a fault around the buffers that the library uses, and handling the fault hitting those buffers generates.

Or you could just be the richest company in the world like Apple and pay market rates to top talent to invest in your architecture.

I’m rapidly losing patience with major companies posting record profits next to unprecedented software calamities.

It starts and ends with an elite corporate culture that doesn’t value what we do.

Post reply on HN