Code Monkey home page Code Monkey logo

Comments (15)

nikias avatar nikias commented on May 28, 2024

Nice! Happy New Year :)
I understand that libxml2 is more robust but is has some issues. It's leaking memory and also seems to have problems in multithreaded environments for some reason. That was the reason why I chose to do the custom parsing. See the improvements in the comments of this ticket: libimobiledevice/libimobiledevice#394
I will take care of the issues. I will probably not be perfect in the end but it will be sufficient enough to parse plist data in the usual environments.

from libplist.

saurik avatar saurik commented on May 28, 2024

@nikias Maybe my point was a little confusing (due to the attempt at cute rhetoric/story), but I was actually providing a much more robust reason why you can't use libxml2: Apple also implemented a custom XML parser, and some of the things they support are simply not going to be possible to simulate using libxml2. So, game on! If I have some time I'll be contributing patches to make this parser closely match the behavior I'm observing from Apple's list files. (If the issue really were just memory leaks or something, I'd rather go fix libxml2, but it turns out that libplist really needs a custom parser ;P.)

from libplist.

saurik avatar saurik commented on May 28, 2024

(I was just talking about this with @DHowett, and he pointed out that Apple has changed the license on CFLite to MIT and open-sourced it all as part of Swift, so anyone who ends up here as part of tracking down a parser differential might consider trying to use Apple's code to try to get exactly the expected behavior.)

from libplist.

posixninja avatar posixninja commented on May 28, 2024

meh, always killing my 0dayz... libxml2 and apple's development teams are on par for their issue response. it couldn't possibly get any worse!!

from libplist.

posixninja avatar posixninja commented on May 28, 2024

Ok perhaps a more constructive comment. can we perhaps create some test units? plist really isn't nearly as complicated as xml is. this surely could be made secure (even if not fully compliant with standards)

from libplist.

nikias avatar nikias commented on May 28, 2024

I just pushed several commits that fix the first 6 issues/examples in this list.
@saurik I am not yet sure how to handle the other cases (text after the actual XML, unclosed attributes etc.) but I must really say the "libplist detection" cases are really nice haha :D
@posixninja make check does some tests. In fact I am making a test file right now that tests the issues fixed in with latest commits.

from libplist.

nikias avatar nikias commented on May 28, 2024

Added several test cases.

from libplist.

Tatsh avatar Tatsh commented on May 28, 2024

Does Python's plistlib (Python 3+) have the same issues?

from libplist.

nikias avatar nikias commented on May 28, 2024

plistlib uses expat XML parser so I doubt it has the same issues :)

from libplist.

nikias avatar nikias commented on May 28, 2024

however it will probably have the Apple-only issues listed above.

from libplist.

xdeng avatar xdeng commented on May 28, 2024

@nikias I use the multi-threaded environment seems to be no problem, Make some changes to the source code, I did not initialize and release multiple times

from libplist.

xdeng avatar xdeng commented on May 28, 2024

@nikias Can you separate the custom XML parser branch and libxml2 bugfixes branch ?

my English is not very good :(

from libplist.

nikias avatar nikias commented on May 28, 2024

@xdeng the custom xml parser works fine so I don't see any reason to switch back. There are some differences but it isn't really a problem for every day usage (like with libimobiledevice).

from libplist.

mexmer avatar mexmer commented on May 28, 2024

@saurik just note, apple devices can create XML that contains null character inside element value, and it's like that since iOS 3 at least.

my xmlparser is based on expat library.

also, as for issues mentioned above, have not seen any of them, except not closed attribute, which out parser can take care off (it ignores attribute in fact)

from libplist.

xdeng avatar xdeng commented on May 28, 2024

I ran into a big plist file
xml format
4x,xxx nodes
file size 15MB
Using old library parsing will take up very high memory 200MB
I want to try the new library now.

from libplist.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.