Hi,

When using libaacs with mythtv I was getting the following crash: 
        2010-11-27 13:12:48.603 OpenFile() trying BD at /mnt/
        2010-11-27 13:12:48.603 BDRingBuffer: Opened BDRingBuffer device at 
/mnt/
        libaacs/aacs.c:548: libaacs [92]
        libaacs/aacs.c:550: Initializing libgcrypt...
        
        Program received signal SIGSEGV, Segmentation fault.
        0xb052085a in yylex () from /usr/lib/dri/i965_dri.so
        (gdb) bt
        #0  0xb052085a in yylex () from /usr/lib/dri/i965_dri.so
        #1  0xafe1529a in yyparse (scanner=0xafd24b48, dklist=0xafd3fa60, 
pklist=0xae054a70, clist=0xafd39af8, celist=0xae086908, dkplist=0x0) at 
keydbcfg-parser.c:1537
        #2  0xafe15a22 in keydbcfg_parse_config (cfgfile=0xae036898, 
path=0xae0517c8 "/var/lib/mythtv/.mythtv/KEYDB.cfg") at 
file/keydbcfg-parser.y:440
        #3  0xafe0e162 in aacs_open (path=0xafd32010 "/mnt/", 
configfile_path=0xafd32cd0 "/var/lib/mythtv/.mythtv/KEYDB.cfg") at 
libaacs/aacs.c:575
        #4  0xb7dd790d in bd_open () from /usr/lib/libmythtv-0.24.so.0
        #5  0xafd6d368 in ?? ()
        Backtrace stopped: previous frame inner to this frame (corrupt stack?)

Obviously the linker has picked the wrong yylex.

I solved this with the following patch which renames all the yy* symbols
to libaacs_yy*. (I'm going to create a similar patch for i965_dri.so
too).

It's possible that the right thing to do would have been to fiddle with
the linker such that the yy* symbols were internal to the library and
therefore weren't subject to being incorrectly linked externally. I've
no idea how to go about arranging for that though (is it even possible
for .a files).

Anyway, with this patch I was able to successfully playback a blu-ray
disk under mythtv 0.24.

Thanks,
Ian.

diff --git a/src/Makefile.am b/src/Makefile.am
index cb7983c..8d9dba3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -15,7 +15,7 @@ SET_INCLUDES = -I$(top_srcdir) -Ifile
 
 AM_CFLAGS = -std=c99 $(SET_FEATURES) $(SET_WARNINGS) $(SET_OPTIMIZATIONS) \
        $(SET_DEBUG_OPTS) $(SET_INCLUDES) $(LIBGCRYPT_CFLAGS)
-AM_YFLAGS = -d
+AM_YFLAGS = -d -p libaacs_yy
 CFLAGS=$(shell test -z "$$CFLAGS" || echo "$$CFLAGS")
 
 lib_LTLIBRARIES = libaacs.la
diff --git a/src/file/keydbcfg-lexer.l b/src/file/keydbcfg-lexer.l
index 74635a4..99b0713 100644
--- a/src/file/keydbcfg-lexer.l
+++ b/src/file/keydbcfg-lexer.l
@@ -38,6 +38,8 @@ static char *trim_string(const char *string);
 %option noinput
 %option nounput
 %option yylineno
+%option outfile="lex.yy.c"
+%option prefix="libaacs_yy"
 
 %s TITLE_STATE
 
diff --git a/src/file/keydbcfg-parser.y b/src/file/keydbcfg-parser.y
index d716a09..a3d31df 100644
--- a/src/file/keydbcfg-parser.y
+++ b/src/file/keydbcfg-parser.y
@@ -81,7 +81,7 @@ static int add_date_entry(title_entry_list *list, unsigned 
int year,
 void yyerror (void *scanner, dk_list *dklist, pk_list *pklist, cert_list 
*clist,
               title_entry_list *celist, digit_key_pair_list *dkplist,
               const char *msg);
-extern int yyget_lineno  (void *scanner);
+extern int libaacs_yyget_lineno  (void *scanner);
 
 /* uncomment the line below for debugging */
 // int yydebug = 1;
@@ -162,7 +162,7 @@ config_entry
   | error NEWLINE
     {
       fprintf(stderr, "bad entry at or around line %d\n",
-              yyget_lineno(scanner) - 1);
+              libaacs_yyget_lineno(scanner) - 1);
       yyerrok;
     }
   ;
@@ -435,11 +435,11 @@ int keydbcfg_parse_config(config_file *cfgfile, const 
char *path)
   digit_key_pair_list *dkplist = NULL;
 
   void *scanner;
-  yylex_init(&scanner);
-  yyset_in(fp, scanner);
+  libaacs_yylex_init(&scanner);
+  libaacs_yyset_in(fp, scanner);
   int retval = yyparse(scanner, head_dklist, head_pklist, head_clist,
                        head_celist, dkplist);
-  yylex_destroy(scanner);
+  libaacs_yylex_destroy(scanner);
 
   cfgfile->dkl = head_dklist;
   cfgfile->pkl = head_pklist;
@@ -735,5 +735,5 @@ void yyerror (void *scanner, dk_list *dklist, pk_list 
*pklist, cert_list *clist,
               title_entry_list *celist, digit_key_pair_list *dkplist,
               const char *msg)
 {
-  fprintf(stderr, "%s: line %d\n", msg, yyget_lineno(scanner));
+  fprintf(stderr, "%s: line %d\n", msg, libaacs_yyget_lineno(scanner));
 }

-- 
Ian Campbell

I THINK THEY SHOULD CONTINUE the policy of not giving a Nobel Prize for
paneling.
                -- Jack Handey, The New Mexican, 1988.

_______________________________________________
libaacs-devel mailing list
[email protected]
http://mailman.videolan.org/listinfo/libaacs-devel

Reply via email to