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

Segfault on stray character in file #169

Open
lorenzhs opened this Issue Nov 9, 2017 · 1 comment

Comments

Projects
None yet
1 participant
@lorenzhs

lorenzhs commented Nov 9, 2017

I admit that this is kind of a specialised issue that shouldn't usually occur, but sometimes I edit my ipe files with emacs for search-replace things (this might not be recommended...). Today, I must have mispressed a key somewhere, and added a single letter 's' outside of an element, like this:

384 320 l
</path>s
<text matrix="1 0 0 1 340 -2" ...

This causes ipe 7.2.7 to segfault. Ideally, ipe would catch this and remove the garbage character, or warn that there's a parsing error on line XYZ. With the current behaviour, it was quite hard to catch the mistake.

Backtrace from gdb (sorry, ipe-dbgsym on debian seems to be incomplete):

(gdb) bt full
#0  0x00007ffff7546e30 in ipe::ImlParser::parseObject(ipe::String, ipe::Page*, int*) () from /usr/lib/libipe.so.7.2.7
No symbol table info available.
#1  0x00007ffff7547d2b in ipe::ImlParser::parsePage(ipe::Page&) () from /usr/lib/libipe.so.7.2.7
No symbol table info available.
#2  0x00007ffff754b6fe in ipe::ImlParser::parseDocument(ipe::Document&) () from /usr/lib/libipe.so.7.2.7
No symbol table info available.
#3  0x00007ffff756f73e in doParse(ipe::Document*, ipe::ImlParser&, int&) () from /usr/lib/libipe.so.7.2.7
No symbol table info available.
#4  0x00007ffff756f7e1 in doParseXml(ipe::DataSource&, int&) () from /usr/lib/libipe.so.7.2.7
No symbol table info available.
#5  0x00007ffff7570936 in ipe::Document::load(char const*, int&) () from /usr/lib/libipe.so.7.2.7
No symbol table info available.
#6  0x00007ffff779810a in ?? () from /usr/lib/libipelua.so.7.2.7
No symbol table info available.
#7  0x00007ffff70c077e in luaD_precall (L=L@entry=0x5555557a1178, func=func@entry=0x555555871f20, 
    nresults=nresults@entry=2) at ldo.c:365
        n = <optimized out>
        f = 0x7ffff7798080
        ci = 0x5555558ae9b0
#8  0x00007ffff70cd565 in luaV_execute (L=L@entry=0x5555557a1178) at lvm.c:1134
        b = <optimized out>
        nresults = 2
        i = <optimized out>
        ra = 0x555555871f20
        ci = <optimized out>
        cl = 0x55555581c1f0
        k = 0x55555581a370
        base = <optimized out>
#9  0x00007ffff70c0b6f in luaD_call (L=L@entry=0x5555557a1178, func=<optimized out>, nResults=nResults@entry=1)
    at ldo.c:496
No locals.
#10 0x00007ffff70c0bc1 in luaD_callnoyield (L=L@entry=0x5555557a1178, func=<optimized out>, 
    nResults=nResults@entry=1) at ldo.c:506
No locals.
#11 0x00007ffff70bc4ec in lua_callk (L=L@entry=0x5555557a1178, nargs=nargs@entry=2, nresults=nresults@entry=1, 
    ctx=ctx@entry=0, k=k@entry=0x0) at lapi.c:924
        func = <optimized out>
#12 0x00007ffff70dbf4c in ll_require (L=0x5555557a1178) at loadlib.c:570
        name = 0x5555557f7298 "main"
#13 0x00007ffff70c077e in luaD_precall (L=L@entry=0x5555557a1178, func=func@entry=0x5555557a17d0, 
    nresults=nresults@entry=0) at ldo.c:365
        n = <optimized out>
        f = 0x7ffff70dbe90 <ll_require>
        ci = 0x5555557f7350
#14 0x00007ffff70cd565 in luaV_execute (L=L@entry=0x5555557a1178) at lvm.c:1134
        b = <optimized out>
        nresults = 0
        i = <optimized out>
        ra = 0x5555557a17d0
        ci = <optimized out>
        cl = 0x5555557f6c50
        k = 0x5555557f7300
        base = <optimized out>
#15 0x00007ffff70c0b6f in luaD_call (L=L@entry=0x5555557a1178, func=<optimized out>, nResults=<optimized out>)
    at ldo.c:496
No locals.
#16 0x00007ffff70c0bc1 in luaD_callnoyield (L=0x5555557a1178, func=<optimized out>, nResults=<optimized out>)
    at ldo.c:506
No locals.
#17 0x00007ffff70bff92 in luaD_rawrunprotected (L=L@entry=0x5555557a1178, f=f@entry=0x7ffff70bafa0 <f_call>, 
    ud=ud@entry=0x7fffffffd9a0) at ldo.c:142
        oldnCcalls = 0
        lj = {previous = 0x0, b = {{__jmpbuf = {93824994644344, -5680861526471265018, 0, 1, 1, 93824994644440, 
                5680861527570068742, 5680843006555665670}, __mask_was_saved = 0, __saved_mask = {__val = {0, 
                  140737338099576, 140737488345552, 140737351972631, 0, 0, 0, 0, 0, 0, 0, 0, 0, 71776119061217280, 
                  4602683322772274282, 0}}}}, status = 0}
#18 0x00007ffff70c0e4d in luaD_pcall (L=L@entry=0x5555557a1178, func=func@entry=0x7ffff70bafa0 <f_call>, 
    u=u@entry=0x7fffffffd9a0, old_top=48, ef=<optimized out>) at ldo.c:727
        status = <optimized out>
        old_ci = 0x5555557a11d8
        old_allowhooks = 1 '\001'
        old_nny = 1
        old_errfunc = 0
#19 0x00007ffff70bc5c1 in lua_pcallk (L=0x5555557a1178, nargs=0, nresults=0, errfunc=<optimized out>, ctx=0, k=0x0)
    at lapi.c:968
        c = {func = 0x5555557a17c0, nresults = 0}
        status = <optimized out>
        func = <optimized out>
#20 0x00005555555656a7 in lua_run_ipe (fn=0x55555556d530 <mainloop(lua_State*)>, L=0x5555557a1178)
    at main_common.i:93
No locals.
#21 main (argc=<optimized out>, argv=<optimized out>) at main_qt.cpp:137
        a = <incomplete type>
        r = <optimized out>
@lorenzhs

This comment has been minimized.

Show comment
Hide comment
@lorenzhs

lorenzhs Nov 9, 2017

Just wanted to add: I understand if you consider this usecase unsupported and the "bug" report invalid. It is a bit non-traditional to edit ipe file with emacs, after all!

lorenzhs commented Nov 9, 2017

Just wanted to add: I understand if you consider this usecase unsupported and the "bug" report invalid. It is a bit non-traditional to edit ipe file with emacs, after all!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment