¿Por qué las cadenas especiales en árabe provocan que las aplicaciones fallen en iOS y OS X?
Veamos dónde se estropean las cosas. A juzgar por los fallos de iOS y OSX, parecen fallar en diferentes lugares.
El bloqueo de iOS ocurre en ComplexTextController::adjustGlyphsAndAdvances() de WebCore, mientras que el bloqueo de OSX ocurre en TRun::TRun(TRun constamp;, CFRange, TRun::SubrangingStyle) o TRun::TruncateUnorderedEnd( CFRange) de CoreText , bool, constamp TcharStream;), etc.
Como no conozco la versión del código fuente del binario, no estoy seguro de en qué línea del código fuente iOS ajustaGlyphsAndAdvances falla. OSX falla en CoreText, pero no puedo descartar que WebCore llame a la función CTTypesetterCreateLine de CoreText pasada por WebCore.
El mismo problema existe con algunos controles en 10.9, donde el Finder falla cuando el nombre del archivo se establece en ese carácter (si coloca el archivo en el escritorio...).
Entonces, ¿por qué este problema no es causado únicamente por CoreText?
En primer lugar, OSX 10.8 no falla al usar Firefox.
En segundo lugar, en OSX 10.8, este error se puede evitar simplemente modificando WebCore (comentando la primera mitad de esto si):
// if (!m_mayUseNaturalWritingDirection || m_run . direccionalOverride()) {
// static const void* optionKeys[] = { kCTTypesetterOptionForcedEmbeddingLevel };
// const short ltrForcedEmbeddingLevelValue = 0;
/ / const short rtlForcedEmbeddingLevelValue = 1;
// static const void* ltrOptionValues[] = { CFNumberCreate(kCFAllocatorDefault, kCFNumberShortType, amp; ltrForcedEmbeddingLevelValue) }; [] = { CFNumberCreate(kCFAllocatorDefault, kCFNumberShortType, & rtlForcedEmbeddingLevelValue) };
// static CFDictionaryRef ltrTypesetterOptions = CFDictionaryCreate(kCFAllocatorDefault, optionKeys, ltrOptionValues, WTF_ARRAY_LENGTH(optionKeys), & kCFCopyStringDiction aryKeyCallBacks, & kCFTypeDictionaryValueCallBacks ; /#if PLATAFORMA(IOS) || __MAC_OS_X_VERSION_ MIN_REQUIRED gt;= 1070
// ProviderInfo info = { cp, length, stringAttributes.typesetter = adoptCF(wkCreateCTTypesetterWithUniCharProviderAndOptions(amp; provideStringAndAttributes, 0, amp ;info, m_run.ltr() ?ltrTypesetterOptions: rtlTypesetterOptions));
//#else
// RetainPtrlt; CFStringRefgt; string = adoptCF( CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault, cp, length, kCFAllocatorNull)); ;CFAttributedStringRefgt; atributedString = adoptCF(CFAttributedStringCreate(kCFAllocatorDefault, string.get(), stringAttributes.get());
// RetainPtrlt; CTTypesetterRefgt; tipógrafo = adoptCF(CTTypesetterCreateWithAttributedStringAndOptions(attributedString.get(), m_run .ltr() ? CFRangeMake(0, 0));
// } else {
Información del proveedor = {cp, longitud, stringAttributes.get() }; >
línea = adoptCF( wkCreateCTLineWithUniCharProvider(amp; provideStringAndAttributes, 0, amp; info));
// }