Skip to content
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

Unicode 0x0 character causes crash #66

Open
wcheswick opened this issue Feb 27, 2013 · 0 comments
Open

Unicode 0x0 character causes crash #66

wcheswick opened this issue Feb 27, 2013 · 0 comments

Comments

@wcheswick
Copy link

In Font.m, line 185, a zero character causes an array bounds exception. This work-around makes the crash go away, but might not be the solution:

  • (unichar)encodedUnicodeValue:(CharacterCode)character
    {
    NSStringEncoding stringEncoding = nativeEncoding(self.encoding);
    const char str[] = {character, '\0'};
    if (character == 0) {
    // ches NSLog(@"encodedUnicodeValue: %x %x",stringEncoding, character);
    return 0;
    }
    return [[NSString stringWithCString:str encoding:stringEncoding] characterAtIndex:0];
    }

The characterAtIndex:0 is unhappy when the string is empty. I don't yet understand why
this character appears---perhaps there is some PDF decoding that is wrong. I can supply
a document with these errors.

ches

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

No branches or pull requests

1 participant