postiffm / bibledit-desktop

Desktop version of Bibledit
GNU General Public License v3.0
4 stars 6 forks source link

Seg fault on Check | Markers | Validate #107

Closed postiffm closed 5 years ago

postiffm commented 5 years ago

Failure occurs with Inpui Naga translation on whole NT.

Pickle commented 5 years ago

testing on 64 bit windows build with trunk rev3 did not crash rev2 crashed here

#0 0x7ffff01e8327   _int_malloc(av=av@entry=0x7ffff050c640 <main_arena>, bytes=bytes@entry=537) (malloc.c:3822)
#1 0x7ffff01ea3d0   __GI___libc_malloc(bytes=537) (malloc.c:2918)
#2 0x7ffff0cde598   operator new(unsigned long) (sz=537) (../../../../libstdc++-v3/libsupc++/new_op.cc:50)
#3 0x7ffff0d1c919   __gnu_cxx::new_allocator<char>::allocate(unsigned long, void const*) (this=<optimized out>, __n=<optimized out>) (/usr/src/debug/gcc-8.2.1+r264010/obj-x86_64-suse-linux/x86_64-suse-linux/libstdc++-v3/include/bits/basic_string.tcc:995)
#4 0x7ffff0d1c919   std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (__capacity=512, __old_capacity=<optimized out>, __alloc=...) (/usr/src/debug/gcc-8.2.1+r264010/obj-x86_64-suse-linux/x86_64-suse-linux/libstdc++-v3/include/bits/basic_string.tcc:1057)
#5 0x7ffff0d1d78b   std::string::_Rep::_M_clone(std::allocator<char> const&, unsigned long) (this=0x89a1e0 <std::string::_Rep::_S_empty_rep_storage@@GLIBCXX_3.4>, __alloc=..., __res=<optimized out>) (/usr/src/debug/gcc-8.2.1+r264010/obj-x86_64-suse-linux/x86_64-suse-linux/libstdc++-v3/include/bits/basic_string.tcc:1073)
#6 0x7ffff0d1d834   std::string::reserve(unsigned long) (this=this@entry=0x7fffff7ff0f8, __res=<optimized out>) (/usr/src/debug/gcc-8.2.1+r264010/obj-x86_64-suse-linux/x86_64-suse-linux/libstdc++-v3/include/bits/basic_string.tcc:951)
#7 0x7ffff0d15287   std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::overflow(int) (this=0x7fffff7ff2b8, __c=49) (/usr/src/debug/gcc-8.2.1+r264010/obj-x86_64-suse-linux/x86_64-suse-linux/libstdc++-v3/include/bits/char_traits.h:363)
#8 0x7ffff0d6944b   std::basic_streambuf<char, std::char_traits<char> >::xsputn(char const*, long) (this=0x7fffff7ff2b8, __s=0x7fffff7ff197 "1\245\356\324\360\377\177", __n=1) (/usr/src/debug/gcc-8.2.1+r264010/obj-x86_64-suse-linux/x86_64-suse-linux/libstdc++-v3/include/bits/char_traits.h:369)
#9 0x7ffff0d4ef75   std::basic_streambuf<char, std::char_traits<char> >::sputn(char const*, long) (__n=<optimized out>, __s=<optimized out>, this=0x7fffff7ff2b8) (/usr/src/debug/gcc-8.2.1+r264010/obj-x86_64-suse-linux/x86_64-suse-linux/libstdc++-v3/include/bits/ios_base.h:727)
#10 0x7ffff0d4ef75  std::ostreambuf_iterator<char, std::char_traits<char> >::_M_put(char const*, long) (__len=<optimized out>, __ws=<optimized out>, this=<synthetic pointer>) (/usr/src/debug/gcc-8.2.1+r264010/obj-x86_64-suse-linux/x86_64-suse-linux/libstdc++-v3/include/bits/streambuf_iterator.h:281)
#11 0x7ffff0d4ef75  std::__write<char>(std::ostreambuf_iterator<char, std::char_traits<char> >, char const*, int) (__len=<optimized out>, __ws=<optimized out>, __s=...) (/usr/src/debug/gcc-8.2.1+r264010/obj-x86_64-suse-linux/x86_64-suse-linux/libstdc++-v3/include/bits/locale_facets.h:121)
#12 0x7ffff0d4ef75  std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::_M_insert_int<unsigned long>(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, unsigned long) const(this=<optimized out>, __s=..., __io=..., __fill=<optimized out>, __v=<optimized out>) (/usr/src/debug/gcc-8.2.1+r264010/obj-x86_64-suse-linux/x86_64-suse-linux/libstdc++-v3/include/bits/locale_facets.tcc:933)
#13 ??  0x00007ffff0d5ac05 in std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::put(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, unsigned long) const (__v=1, __fill=<optimized out>, __io=..., __s=..., this=0x7ffff0fcd010 <(anonymous namespace)::num_put_c>) (/usr/src/debug/gcc-8.2.1+r264010/obj-x86_64-suse-linux/x86_64-suse-linux/libstdc++-v3/include/bits/ostream.tcc:63)
#14 0x7ffff0d5ac05  std::ostream::_M_insert<unsigned long>(unsigned long) (this=this@entry=0x7fffff7ff2b0, __v=__v@entry=1) (/usr/src/debug/gcc-8.2.1+r264010/obj-x86_64-suse-linux/x86_64-suse-linux/libstdc++-v3/include/bits/ostream.tcc:73)
#15 0x4323d0    std::ostream::operator<<(unsigned int) (__n=1, this=0x7fffff7ff2b0) (/usr/include/c++/4.8/ostream:196)
#16 0x4323d0    convert_to_string(unsigned int) (i=i@entry=1) (tiny_utilities.cpp:51)
#17 0x457ebd    project_data_directory_chapter(Glib::ustring const&, unsigned int, unsigned int) (project=..., book=book@entry=65, chapter=chapter@entry=1) (projectutils.cpp:135)
#18 0x457f5b    project_data_filename_chapter(Glib::ustring const&, unsigned int, unsigned int, bool) (project=..., book=book@entry=65, chapter=chapter@entry=1, checkexists=checkexists@entry=false) (projectutils.cpp:143)
#19 0x4588b2    project_retrieve_chapter(Glib::ustring const&, unsigned int, unsigned int) (project=..., book=book@entry=65, chapter=chapter@entry=1) (projectutils.cpp:372)
#20 0x458f6a    project_get_verses(Glib::ustring const&, unsigned int, unsigned int) (project=..., book=book@entry=65, chapter=chapter@entry=1) (projectutils.cpp:470)
#21 0x45a433    project_retrieve_verse_extended(Glib::ustring const&, unsigned int, unsigned int, Glib::ustring const&) (project=..., book=book@entry=65, chapter=chapter@entry=1, verse=...) (projectutils.cpp:319)
#22 0x45ab94    project_retrieve_verse(Glib::ustring const&, unsigned int, unsigned int, Glib::ustring const&) (project=..., book=book@entry=65, chapter=chapter@entry=1, verse=...) (projectutils.cpp:362)
#23 0x45a902    project_retrieve_verse_extended(Glib::ustring const&, unsigned int, unsigned int, Glib::ustring const&) (project=..., book=book@entry=65, chapter=chapter@entry=1, verse=...) (projectutils.cpp:339)
#24 0x45ab94    project_retrieve_verse(Glib::ustring const&, unsigned int, unsigned int, Glib::ustring const&) (project=..., book=book@entry=65, chapter=chapter@entry=1, verse=...) (projectutils.cpp:362)
#25 0x45a902    project_retrieve_verse_extended(Glib::ustring const&, unsigned int, unsigned int, Glib::ustring const&) (project=..., book=book@entry=65, chapter=chapter@entry=1, verse=...) (projectutils.cpp:339)
#26 0x45ab94    project_retrieve_verse(Glib::ustring const&, unsigned int, unsigned int, Glib::ustring const&) (project=..., book=book@entry=65, chapter=chapter@entry=1, verse=...) (projectutils.cpp:362)
#27 0x45a902    project_retrieve_verse_extended(Glib::ustring const&, unsigned int, unsigned int, Glib::ustring const&) (project=..., book=book@entry=65, chapter=chapter@entry=1, verse=...) (projectutils.cpp:339)
#28 0x45ab94    project_retrieve_verse(Glib::ustring const&, unsigned int, unsigned int, Glib::ustring const&) (project=..., book=book@entry=65, chapter=chapter@entry=1, verse=...) (projectutils.cpp:362)
#29 0x45a902    project_retrieve_verse_extended(Glib::ustring const&, unsigned int, unsigned int, Glib::ustring const&) (project=..., book=book@entry=65, chapter=chapter@entry=1, verse=...) (projectutils.cpp:339)

Edit - internet suggests this might an error happening somewhere else. I plan to run the program with valgrind and maybe find the root cause

Edit2 - rev 1 also fails in the same spot. Its in the book of Jude. Tried running valgrind but from the errors reported I could not see anything i thought could be fixed. Most are low level leaks reported from gtk, which i suspect are false positives.

postiffm commented 5 years ago

@Pickle I take it that rev[1,2,3] refers to usfm_rev1, usfm_rev2, etc. My first (wild) guess is that Bibledit is walking past the end of a book or trying to look in books "after" Revelation. It just happens that a bad memory access happens in this routine because it is the first time any memory is accessed in the ghost book or chapter.

postiffm commented 5 years ago

rev3 does not cause a crash. rev2 definitely does. It spins through the NT books very fast, and then comes to Jude, and then stops...

We had to make a change to Jude in rev3 that I think relates to this problem: Jude did not have a \c 1 chapter 1 marker. I presume that whoever created the USFM didn't think you needed that for a single-chapter book like Jude. But...the other single-chapter books do have it.

Now the question is...how do we make bibledit-desktop not crash when it encounters this. It should be able to handle it...after all, this is a USFM marker check!

postiffm commented 5 years ago

Looks like the program falls into an infinite loop of calling project_retrieve_verse and project_retrieve_verse_extended and then project_retrieve_verse again, and so on. It can't make any forward progress. Need to figure out a way to break this cycle from the beginning.

postiffm commented 5 years ago

This is fixed in cefdc62.

postiffm commented 5 years ago

I recognized that chapters with number 0 (intro material) never have any verses. Also, if a chapter number is not seen before a \v, then this is an error and the code is smarter about it now.

Pickle commented 5 years ago

Matt,

I pulled the changes in and i not longer have the crash and see the warnings reported.

Scott

On Thu, Jun 13, 2019 at 11:04 PM Matt Postiff notifications@github.com wrote:

I recognized that chapters with number 0 (intro material) never have any verses. Also, if a chapter number is not seen before a \v, then this is an error and the code is smarter about it now.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/postiffm/bibledit-desktop/issues/107?email_source=notifications&email_token=AADI4ZKIFWU43UR6M6DLHBLP2MDCNA5CNFSM4HWH4JOKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXVSQ7A#issuecomment-501950588, or mute the thread https://github.com/notifications/unsubscribe-auth/AADI4ZMVI4KFH5PO5E325ATP2MDCNANCNFSM4HWH4JOA .