control: tags -1 + patch [Sebastian Ramacher] > libxml2.9 is not going to be released with forky (#1112209). Please > switch back to libxml2-dev.
A fix for this has been sent upstream, see <URL: https://sourceforge.net/p/lsdvd/patches/11/ >, and has been included into git upstream to be included in a new release. diff --git a/oxml.c b/oxml.c index cc59ee5..ff87412 100644 --- a/oxml.c +++ b/oxml.c @@ -21,9 +21,9 @@ static xmlChar * ConvertInput(const char *in, const char *encoding) { xmlChar *out; - int size; - int out_size; xmlCharEncodingHandlerPtr handler; + xmlBufferPtr inbuf, outbuf; + int ret; if (in == 0) return 0; @@ -36,34 +36,34 @@ ConvertInput(const char *in, const char *encoding) return 0; } - size = (int) strlen(in) + 1; - out_size = size * 4 - 1; // Assume max 4 bytes for each character in UTF-8 - out = (unsigned char *) xmlMalloc((size_t) out_size); - - if (out != 0) { - int ret; - int temp; - temp = size - 1; - ret = handler->input(out, &out_size, (const xmlChar *) in, &temp); - if ((ret < 0) || (temp - size + 1)) { - if (ret < 0) { - printf("ConvertInput: conversion wasn't successful.\n"); - } else { - printf - ("ConvertInput: conversion wasn't successful. converted: %i octets.\n", - temp); - } + inbuf = xmlBufferCreate(); + if (inbuf) + xmlBufferAdd(inbuf, (const xmlChar *)in, strlen(in)); + outbuf = xmlBufferCreate(); - xmlFree(out); - out = NULL; - } else { - out = (unsigned char *) xmlRealloc(out, out_size + 1); - out[out_size] = 0; /*null terminating out */ - } - } else { - printf("ConvertInput: no mem\n"); + if (inbuf == NULL || outbuf == NULL) { + printf("ConvertInput: unable to allocate memory\n"); + if (inbuf) xmlBufferFree(inbuf); + if (outbuf) xmlBufferFree(outbuf); + xmlCharEncCloseFunc(handler); + return 0; + } + + ret = xmlCharEncInFunc(handler, outbuf, inbuf); + if (ret < 0) { + printf("ConvertInput: charset encoding conversion failed.\n"); + xmlBufferFree(inbuf); + xmlBufferFree(outbuf); + xmlCharEncCloseFunc(handler); + return 0; } + out = xmlStrdup(xmlBufferContent(outbuf)); + + xmlBufferFree(inbuf); + xmlBufferFree(outbuf); + xmlCharEncCloseFunc(handler); + return out; } -- Happy hacking Petter Reinholdtsen

