[btOOL] segfault in bt_create_name_format
Status: Beta
Brought to you by:
gward
|
From: Brent S. <bs...@uc...> - 2005-04-27 20:27:13
|
Hello,
While working with the Text::BibTeX module, I was able to make
perl (I think, or maybe the btparse library?) segfault. Here is some
data pertaining to the segfault.
Version of Text::BibTeX : 0.34
Version of btparse: 0.34
perl version: This is perl, v5.8.5 built for i686-linux
smitten@brent bibliography $ gdb perl
GNU gdb 6.0
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-pc-linux-gnu"...Using host libthread_db
library "/lib/tls/libthread_db.so.1".
(gdb) run ./article_manager.pl
Starting program: /usr/bin/perl ./article_manager.pl
[Thread debugging using libthread_db enabled]
[New Thread -1209788736 (LWP 20485)]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1209788736 (LWP 20485)]
0xb7ea75c3 in strlen () from /lib/tls/libc.so.6
(gdb) bt
#0 0xb7ea75c3 in strlen () from /lib/tls/libc.so.6
#1 0xb7e38884 in bt_create_name_format (parts=0x0, abbrev_first=0) at
src/format_name.c:104
#2 0xb7e30a2d in XS_Text__BibTeX__NameFormat_create (cv=0x81d0c30) at
BibTeX.xs:385
#3 0x080c4a99 in Perl_pp_entersub () at pp_hot.c:2857
#4 0x080ab96b in Perl_runops_debug () at dump.c:1442
#5 0x08062e5c in S_run_body (oldscope=0) at perl.c:1924
#6 0x08062baa in perl_run (my_perl=0x8154008) at perl.c:1843
#7 0x0805f567 in main (argc=0, argv=0x0, env=0xbfffedc0) at perlmain.c:86
(gdb)
Here is the script that is causing this segfault:
#!/usr/bin/perl
#
# Author: Brent Smith <bs...@uc...>
# Created: 04-27-2005
# Description:
# This is a perl CGI script used to print out all
# entries in a particular bibtex file to an HTML format.
# required modules
use Text::BibTeX;
use Text::BibTeX::Name;
use Text::BibTeX::NameFormat;
$bibfile = new Text::BibTeX::File "Susannah.bib";
$nameformat = new Text::BibTeX::NameFormat;
while ($entry = new Text::BibTeX::Entry $bibfile)
{
next unless $entry->parse_ok;
@names = $entry->exists ('author') ? $entry->names ('author') : "";
foreach my $author (@names) {
$authorname = $author->format ($nameformat);
print "$authorname, ";
}
print $entry->exists ('title') ? $entry->get ('title') : "";
print "\n";
}
It looks like the "parts" parameter to that function was
passed a NULL. Maybe some simple error checking like a
if (!parts) { return NULL; } will fix the issue?
The purpose of the script will be to eventually parse BibTeX
files and sort by an arbitrary field, and then print to HTML
format. Is there something that already does this? I think
it will be an excellent way for faculty/professors to manage
their published articles for their own web sites.
Thanks for you help,
--
Brent Smith <bs...@uc...>
BME Computer Support <bme...@uc...>
530.754.8029
|