summaryrefslogtreecommitdiff
path: root/platform/ios
diff options
context:
space:
mode:
authorPaul Gardiner <paul.gardiner@artifex.com>2014-01-07 12:29:47 +0000
committerPaul Gardiner <paul.gardiner@artifex.com>2014-01-07 16:27:43 +0000
commitea721cfeb7b09d64c06d71648098dd818df2618c (patch)
tree4a625964c3417472dc03b2176890c51b20998c1e /platform/ios
parent9364966a041cd85a3ee4ff9c70324446a46a6414 (diff)
downloadmupdf-ea721cfeb7b09d64c06d71648098dd818df2618c.tar.xz
iOS: protect against crashing when handling accented chars in choice fields
Use conversion assuming ascii as a fallback to assuming utf8. The library should be converting to utf8 but doesn’t currently.
Diffstat (limited to 'platform/ios')
-rw-r--r--platform/ios/Classes/MuPageViewNormal.m9
1 files changed, 8 insertions, 1 deletions
diff --git a/platform/ios/Classes/MuPageViewNormal.m b/platform/ios/Classes/MuPageViewNormal.m
index d240592d..ccfcd65c 100644
--- a/platform/ios/Classes/MuPageViewNormal.m
+++ b/platform/ios/Classes/MuPageViewNormal.m
@@ -1309,7 +1309,14 @@ static void updatePixmap(fz_document *doc, fz_display_list *page_list, fz_displa
(void)pdf_choice_widget_options(idoc, focus, opts);
NSMutableArray *arr = [[NSMutableArray arrayWithCapacity:nopts] retain];
for (int i = 0; i < nopts; i++)
- [arr addObject:[NSString stringWithUTF8String:opts[i]]];
+ {
+ NSString *utf8 = [NSString stringWithUTF8String:opts[i]];
+ // FIXME: temporary patch to handle the library not converting to utf8
+ if (utf8 == nil)
+ utf8 = [NSString stringWithCString:opts[i] encoding:NSASCIIStringEncoding];
+ if (utf8 != nil)
+ [arr addObject:utf8];
+ }
dispatch_async(dispatch_get_main_queue(), ^{
[self invokeChoiceDialog:arr];
[arr release];