Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
User Journal

Journal gwyrdd benyw's Journal: Tivo log: more on writeguide error

I have compiled xmltv2tivo/writeguide with symbol information, and attempted to analyze the core file generated (unfortunately it seems to be corrupt somehow; gdb can't do a stack trace). However, ye olde trusty printfs helped me find the location of the bug, and I have created a very small data file which causes the error.

The offensive headend.txt is:

Guide type=3
 
PostalCode/1/2001000/3 {
        Headend: Headend/1/8001000
        PostalCode: {06010}
}

gdb says the bus error occurs in memmove(). The point in writeguide.c where this happens is:
main()
guide_encode()
add_item() (TYPE_STRING case)
push_mem() (about five lines above the break)

--------------

Update:
Darren pointed out that version 1.4 (the latest) of writeguide dumps core for him too, on windows, but 1.3 does not. I checked out 1.3, compiled it (and changed "fname = strndup(p, v1);" to "fname = strdup(p); fname[v1] = '\0';"), and sure enough, writeguide now runs, and creates a headend slice file! yay!!!

Here is the diff between the two versions. I don't understand the reasons for the change, but from the list archives I gather that it had something to do with accented text.

12a13,14
> #include <libxml/encoding.h>
>
36a39,48
> xmlChar* createUTF8(unsigned char* isolat1Str)
> {
> xmlChar* utf8Str = xmlMalloc(2 * strlen(isolat1Str) * sizeof(utf8Str));
> int utf8StrLength;
> int isolat1StrLength = strlen(isolat1Str);
> isolat1ToUTF8(utf8Str, &utf8StrLength, isolat1Str, &isolat1StrLength);
> *(utf8Str + utf8StrLength) = '\0';
> return utf8Str;
> }
>
237a250,251
> xmlChar *utf8p;
> int utf8pLen;
279a294,295
> utf8p = createUTF8(p);
> utf8pLen = strlen(utf8p) - 1;
281,282c297,299
< push_int(v1);
< push_mem(p, v1);
---
> push_int(utf8pLen);
> push_mem(utf8p, utf8pLen);
> xmlFree(utf8p);
284c301,302
< fname = strndup(p, v1);
---
> fname = strdup(p);
> fname[v1] = '\0';

This discussion has been archived. No new comments can be posted.

Tivo log: more on writeguide error

Comments Filter:

Two can Live as Cheaply as One for Half as Long. -- Howard Kandel

Working...