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

Searching for name-section in PDF can cause a crash #2

Open
daijianshusheng opened this issue Mar 19, 2016 · 4 comments
Open

Searching for name-section in PDF can cause a crash #2

daijianshusheng opened this issue Mar 19, 2016 · 4 comments
Labels

Comments

@daijianshusheng
Copy link
Contributor

Please look at the following functions

- (YPName *)checkName:(size_t *)idx
{
    NSString *name = @"";
    YPName *pdfName;
    NSUInteger i = *idx;
    ++i;

    for (; i < dataLength && !isBlank(rawData[i]) && rawData[i]!='>' && rawData[i]!='/'; ++i) {
        char buffer[] = {rawData[i], 0};

        //Here is interrupted.
        name = [name stringByAppendingString:@(buffer)];     //Thread 1:signal SIGABRT
    }

    *idx = i;
    pdfName = (YPName *)name;
    return pdfName;
}
@mipmip
Copy link
Member

mipmip commented Mar 21, 2016

Please be more explicit. What is the problem here?

@daijianshusheng
Copy link
Contributor Author

If there is no name in the PDF format, it causes the program to crash.

@mipmip
Copy link
Member

mipmip commented Mar 21, 2016

Can you attach a PDF which have this problem?

@mipmip mipmip changed the title Have a BUG Searching for name-section in PDF can cause a crash Mar 21, 2016
@daijianshusheng
Copy link
Contributor Author

test.pdf

@mipmip mipmip added the bug label Mar 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants