Bug#661887: mxml: Bad control character error when attempting to load banks
Message from upstream maintainer (SourceForge): Comment By: Mark McCurry (fundamental) Date: 2012-06-11 08:18 Message: As suspected, this bug report is out of date. While the version of zyn that debian testing ships with has this bug, this bug does not exist in the git head and thus it does not need to be patched. As I stated before there should be a release fairly soon, and I have tested this version on a fresh debian weezy install (32 bit if relevent). If you are able to replicate this bug with the current version of zyn, then feel free to reopen.
Bug#661887: mxml: Bad control character error when attempting to load banks
Thank you Lawrence! I have tested your patch and it fixes the problem on my system. Since there hasn't been any response/action from the maintainer, I've filed a bug report (3534255) on the ZynAddSubFx SourceForge project page. I included your patch in the bug report, so hopefully this will be resolved upstream. -David Hanson
Bug#661887: mxml: Bad control character error when attempting to load banks
On Mon, 11 Jun 2012 07:54:57 +, David Hanson wrote: I have tested your patch and it fixes the problem on my system. Since there hasn't been any response/action from the maintainer, I've filed a bug report (3534255) on the ZynAddSubFx SourceForge project page. I included your patch in the bug report, so hopefully this will be resolved upstream. I should point out that I don’t think the latest upstream ZynAddSubFX has this problem any more. They finessed it by removing support for uncompressed instrument bank files completely, so they no longer rely on the broken zlib functions. -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#661887: mxml: Bad control character error when attempting to load banks
Hi. Here is a proposed fix for this problem. The original code was using gzseek/gzeof/gztell to figure out the uncompressed size of a compressed instrument bank file, to preallocate the buffer for reading its contents, and something in zlib has broken that. I know this is supposed to work, but it’s going to be slow anyway. So this patch replaces that with incremental buffer allocation and reading, in increments of 1 kiB. Looking at the existing bank files, which seem to be only a few kiB in size, this should work OK in terms of both speed and RAM usage. Lawrence D’Oliveiro --- src/Misc/XMLwrapper.cpp-orig 2009-07-16 07:48:41.0 +1200 +++ src/Misc/XMLwrapper.cpp 2012-04-24 16:42:11.968157362 +1200 @@ -300,50 +300,70 @@ return(0); }; +/* wrappers with more convenient and consistent signatures than direct gzread and fread calls */ +static ssize_t read_compressed + ( + void * thefile, + char * buffer, + size_t bufsize + ) + { + return + gzread((gzFile)thefile, buffer, bufsize); + } /*gz_read*/ + +static ssize_t read_uncompressed + ( + void * thefile, + char * buffer, + size_t bufsize + ) + { + return + fread(buffer, bufsize, 1, (FILE *)thefile); + } /*read_uncompressed*/ char *XMLwrapper::doloadfile(const string filename) { char *xmldata=NULL; -int filesize=-1; + size_t datasize = 0; +void * thefile; + ssize_t (*thefile_read)(void * thefile, char * buffer, size_t bufsize); + int (*thefile_close)(void * thefile); + + thefile = gzopen(filename.c_str(),rb); + if (thefile != NULL) + { + thefile_read = read_compressed; + thefile_close = (int (*)(void *))gzclose; + } + else + { + thefile = fopen(filename.c_str(),rb); +if (thefile==NULL) return(NULL); + thefile_read = read_uncompressed; + thefile_close = (int (*)(void *))fclose; + } /*if*/ + for (;;) + { + const size_t increment = 1024; /* something convenient */ + const size_t prevdatasize = datasize; + datasize += increment; + xmldata = (char *)realloc(xmldata, datasize + 1); + if (xmldata == NULL) return(NULL); + const ssize_t bytesread = thefile_read(thefile, xmldata + prevdatasize, increment); + if (bytesread 0) return(NULL); + if (bytesread increment) + { + datasize = prevdatasize + bytesread; + xmldata = (char *)realloc(xmldata, datasize + 1); /* assume shrinking buffer won't fail! */ + xmldata[datasize] = 0; /* terminating null */ + break; + } /*if*/ + } /*for*/ -//try get filesize as gzip data (first) -gzFile gzfile=gzopen(filename.c_str(),rb); -if (gzfile!=NULL) {//this is a gzip file -// first check it's size -while (!gzeof(gzfile)) { -gzseek (gzfile,1024*1024,SEEK_CUR); -if (gztell(gzfile)1000) { -gzclose(gzfile); -goto notgzip;//the file is too big -}; -}; -filesize=gztell(gzfile); - -//rewind the file and load the data -xmldata=new char[filesize+1]; -ZERO(xmldata,filesize+1); - -gzrewind(gzfile); -gzread(gzfile,xmldata,filesize); - -gzclose(gzfile); -return (xmldata); -} else {//this is not a gzip file -notgzip: -FILE *file=fopen(filename.c_str(),rb); -if (file==NULL) return(NULL); -fseek(file,0,SEEK_END); -filesize=ftell(file); - -xmldata=new char [filesize+1]; -ZERO(xmldata,filesize+1); - -rewind(file); -fread(xmldata,filesize,1,file); - -fclose(file); -return(xmldata); -}; + thefile_close(thefile); + return(xmldata); }; bool XMLwrapper::putXMLdata(const char *xmldata)
Bug#661887: mxml: Bad control character error when attempting to load banks
Package: zynaddsubfx Version: 2.4.0-1.2 Followup-For: Bug #661887 Dear Maintainer, I experience the same situation on my system. To investigate the problem, I have run zynaddsubfx via strace: strace -ff -o log zynaddsubfx That's what I've found in one of the logs, after I tried to select one of banks open(/usr/share/zynaddsubfx/banks/William_Godfrey_Collection//0045-Hard Stereo Sweep Synth.xiz, O_RDONLY) = 7 fstat64(7, {st_mode=S_IFREG|0644, st_size=2860, ...}) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb0059000 fstat64(7, {st_mode=S_IFREG|0644, st_size=2860, ...}) = 0 _llseek(7, 0, [0], SEEK_SET)= 0 read(7, \37\213\10\0\0\0\0\0\0\3\355\\Qs\3338\16~\357\257\360\371\275\353\310\211c{\246\355\216/..., 2860) = 2860 _llseek(7, 2860, [2860], SEEK_SET) = 0 close(7)= 0 munmap(0xb0059000, 4096)= 0 write(2, mxml: Bad control character 0x1f..., 62) = 62 When I opened the /usr/share/zynaddsubfx/banks/William_Godfrey_Collection//0045-Hard Stereo Sweep Synth.xiz without decompression, I can see, that indeed the first byte is 0x1f However if I rename it e.g. to test.gz and perform gzip -d test.gz, I can see correct XML file. So the source of the problem is that zynaddsubfx does not recognize the .xiz files as compressed, and attempts to open them directly as XML. *** End of the template - remove these lines *** -- System Information: Debian Release: wheezy/sid APT prefers testing APT policy: (990, 'testing'), (50, 'unstable') Architecture: i386 (i686) Kernel: Linux 3.2.11 (SMP w/2 CPU cores) Locale: LANG=pl_PL.UTF-8, LC_CTYPE=pl_PL.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages zynaddsubfx depends on: ii libasound21.0.25-2 ii libc6 2.13-27 ii libfftw3-33.3-1 ii libfltk1.11.1.10-11 ii libgcc1 1:4.6.3-1 ii libjack-jackd2-0 [libjack-0.116] 1.9.8~dfsg.2-1 ii libmxml1 2.6-2 ii libstdc++64.6.3-1 ii zlib1g1:1.2.6.dfsg-2 zynaddsubfx recommends no packages. zynaddsubfx suggests no packages. -- no debconf information -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#661887: mxml: Bad control character error when attempting to load banks
Package: zynaddsubfx Version: 2.4.0-1.2 Severity: grave Justification: renders package unusable Dear Maintainer, Starting a couple of weeks ago, zynaddsubfx will not load instrument banks or parameter files. Only puts out pure sine wave. It had been working fine for months. Running from the command line gives the following error when trying to load any instrument bank or parameter file: mxml: Bad control character 0x1f not allowed by XML standard! Checked unzipped parameter files with a hex editor, no 0x1f characters in file. Removed and purged zynaddsubfx and libmxml1, re-installed, got the same error. Having the same problem on my laptop (testing, i686pae). -- System Information: Debian Release: wheezy/sid APT prefers testing APT policy: (500, 'testing') Architecture: amd64 (x86_64) Kernel: Linux 3.2.0-1-rt-amd64 (SMP w/1 CPU core; PREEMPT) Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1) Shell: /bin/sh linked to /bin/bash Versions of packages zynaddsubfx depends on: ii libasound21.0.25-2 ii libc6 2.13-26 ii libfftw3-33.3-1 ii libfltk1.11.1.10-10 ii libgcc1 1:4.6.2-12 ii libjack-jackd2-0 [libjack-0.116] 1.9.8~dfsg.1-1 ii libmxml1 2.6-2 ii libstdc++64.6.2-12 ii zlib1g1:1.2.6.dfsg-1 zynaddsubfx recommends no packages. zynaddsubfx suggests no packages. -- no debconf information -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org