diff --git a/NEWS b/NEWS index f5a5053..b2e5953 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,9 @@ +1.33.2 +------ +- libmpg123: +-- Do not modify raw ID3v2 data while parsing (bug 379). This used to be fine + before MPG123_STORE_RAW_ID3 got introduced. Not anymore. + 1.33.1 ------ - INSTALL updated with hints for Windows, mainly. diff --git a/configure b/configure index 3202b0d..325f66c 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.71 for mpg123 1.33.1. +# Generated by GNU Autoconf 2.71 for mpg123 1.33.2. # # Report bugs to . # @@ -621,8 +621,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='mpg123' PACKAGE_TARNAME='mpg123' -PACKAGE_VERSION='1.33.1' -PACKAGE_STRING='mpg123 1.33.1' +PACKAGE_VERSION='1.33.2' +PACKAGE_STRING='mpg123 1.33.2' PACKAGE_BUGREPORT='maintainer@mpg123.org' PACKAGE_URL='' @@ -1727,7 +1727,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures mpg123 1.33.1 to adapt to many kinds of systems. +\`configure' configures mpg123 1.33.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1798,7 +1798,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of mpg123 1.33.1:";; + short | recursive ) echo "Configuration of mpg123 1.33.2:";; esac cat <<\_ACEOF @@ -2077,7 +2077,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -mpg123 configure 1.33.1 +mpg123 configure 1.33.2 generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. @@ -2622,7 +2622,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by mpg123 $as_me 1.33.1, which was +It was created by mpg123 $as_me 1.33.2, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw @@ -3391,7 +3391,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -LIBMPG123_VERSION=49:3:49 +LIBMPG123_VERSION=49:4:49 LIBOUT123_VERSION=5:2:5 LIBSYN123_VERSION=2:3:2 @@ -3992,7 +3992,7 @@ fi # Define the identity of the package. PACKAGE='mpg123' - VERSION='1.33.1' + VERSION='1.33.2' printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h @@ -22468,7 +22468,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by mpg123 $as_me 1.33.1, which was +This file was extended by mpg123 $as_me 1.33.2, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -22536,7 +22536,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -mpg123 config.status 1.33.1 +mpg123 config.status 1.33.2 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" diff --git a/mpg123.spec b/mpg123.spec index 2f1d75b..a0924a5 100644 --- a/mpg123.spec +++ b/mpg123.spec @@ -3,7 +3,7 @@ # - devel packages for alsa, sdl, etc... to build the respective output modules. Summary: The fast console mpeg audio decoder/player. Name: mpg123 -Version: 1.33.1 +Version: 1.33.2 Release: 1 URL: http://www.mpg123.org/ License: GPL diff --git a/src/include/mpg123.h b/src/include/mpg123.h index f5781b2..3b390b7 100644 --- a/src/include/mpg123.h +++ b/src/include/mpg123.h @@ -23,7 +23,7 @@ */ #define MPG123_API_VERSION 49 /** library patch level at client build time */ -#define MPG123_PATCHLEVEL 3 +#define MPG123_PATCHLEVEL 4 #ifndef MPG123_EXPORT /** Defines needed for MS Visual Studio(tm) DLL builds. @@ -338,7 +338,11 @@ enum mpg123_param_flags * the stream is assumed as non-seekable unless overridden. */ ,MPG123_FORCE_SEEKABLE = 0x40000 /**< 19th bit: Force the stream to be seekable. */ - ,MPG123_STORE_RAW_ID3 = 0x80000 /**< store raw ID3 data (even if skipping) */ + ,MPG123_STORE_RAW_ID3 = 0x80000 /**< Store raw ID3 data (even if skipping). + * Before mpg123 1.33.2 (libmpg123 API 49, patchlevel 4), this has to be combined with + * MPG123_SKIP_ID3 to avoid getting corrupted data due to the ID3 parser inserting + * encoding bytes for its own convenience. + */ ,MPG123_FORCE_ENDIAN = 0x100000 /**< Enforce endianess of output samples. * This is not reflected in the format codes. If this flag is set along with * MPG123_BIG_ENDIAN, MPG123_ENC_SIGNED16 means s16be, without diff --git a/src/libmpg123/id3.c b/src/libmpg123/id3.c index 0bd5cda..cb73bd5 100644 --- a/src/libmpg123/id3.c +++ b/src/libmpg123/id3.c @@ -330,9 +330,9 @@ void INT123_id3_link(mpg123_handle *fr) Since we can overwrite strings with ID3 update frames, don't free memory, just grow strings. */ -static void store_id3_text(mpg123_string *sb, unsigned char *source, size_t source_size, const int noquiet, const int notranslate) +static void store_id3_text(mpg123_string *sb, unsigned char encoding, unsigned char *source +, size_t source_size, const int noquiet, const int notranslate) { - unsigned char encoding; if(sb) // Always overwrite, even with nothing. sb->fill = 0; if(!source_size) @@ -345,25 +345,25 @@ static void store_id3_text(mpg123_string *sb, unsigned char *source, size_t sour if(notranslate) { /* Future: Add a path for ID3 errors. */ - if(!mpg123_grow_string(sb, source_size)) + if(!mpg123_grow_string(sb, source_size+1)) { if(noquiet) error("Cannot resize target string, out of memory?"); return; } - memcpy(sb->p, source, source_size); - sb->fill = source_size; - debug1("stored undecoded ID3 text of size %zu", source_size); + sb->p[0] = (char)encoding; + memcpy(sb->p+1, source, source_size); + sb->fill = source_size+1; + debug1("stored undecoded ID3 text of size %zu", source_size+1); return; } - encoding = source[0]; if(encoding > mpg123_id3_enc_max) { if(noquiet) error1("Unknown text encoding %u, I take no chances, sorry!", encoding); return; } - INT123_id3_to_utf8(sb, encoding, source+1, source_size-1, noquiet); + INT123_id3_to_utf8(sb, encoding, source, source_size, noquiet); if(sb->fill) debug1("UTF-8 string (the first one): %s", sb->p); else if(noquiet) error("unable to convert string to UTF-8 (out of memory, junk input?)!"); @@ -449,6 +449,11 @@ static void process_text(mpg123_handle *fr, unsigned char *realdata, size_t real { /* Text encoding $xx */ /* The text (encoded) ... */ + if(realsize < 1) + { + if(NOQUIET) error("Not even an encoding byte?"); + return; + } mpg123_text *t = add_text(fr, id); if(VERBOSE4) fprintf(stderr, "Note: Storing text from %s encoding\n", enc_name(realdata[0])); if(t == NULL) @@ -460,7 +465,8 @@ static void process_text(mpg123_handle *fr, unsigned char *realdata, size_t real ? (char[5]) { t->id[0], t->id[1], t->id[2], t->id[3], 0 } : "(nil)" ); memcpy(t->id, id, 4); - store_id3_text(&t->text, realdata, realsize, NOQUIET, fr->p.flags & MPG123_PLAIN_ID3TEXT); + store_id3_text( &t->text, realdata[0], realdata+1, realsize-1 + , NOQUIET, fr->p.flags & MPG123_PLAIN_ID3TEXT ); if(VERBOSE4) // Do not print unsanitized text to terminals! fprintf(stderr, "Note: ID3v2 %c%c%c%c text frame stored\n", id[0], id[1], id[2], id[3]); } @@ -577,8 +583,6 @@ static void process_comment(mpg123_handle *fr, enum frame_types tt, unsigned cha return; } memcpy(lang, realdata+1, 3); - /* Now I can abuse a byte from lang for the encoding. */ - descr[-1] = encoding; /* Be careful with finding the end of description, I have to honor encoding here. */ text = next_text(descr, encoding, realsize-(descr-realdata)); if(text == NULL) @@ -591,14 +595,14 @@ static void process_comment(mpg123_handle *fr, enum frame_types tt, unsigned cha mpg123_string description; mpg123_init_string(&description); // Store the text, with desired encoding, but for comments always a local copy in UTF-8. - store_id3_text( &description, descr-1, text-descr+1 + store_id3_text( &description, encoding, descr, text-descr , NOQUIET, fr->p.flags & MPG123_PLAIN_ID3TEXT ); if(tt == comment) - store_id3_text( &localcom.description, descr-1, text-descr+1 + store_id3_text( &localcom.description, encoding, descr, text-descr , NOQUIET, 0 ); if(VERBOSE4) fprintf( stderr, "Note: Storing comment from %s encoding\n" - , enc_name(realdata[0]) ); + , enc_name(encoding) ); xcom = tt == uslt ? add_uslt(fr, lang, &description) : add_comment(fr, lang, &description); @@ -616,8 +620,8 @@ static void process_comment(mpg123_handle *fr, enum frame_types tt, unsigned cha mpg123_move_string(&description, &xcom->description); } - text[-1] = encoding; /* Byte abusal for encoding... */ - store_id3_text(&xcom->text, text-1, realsize+1-(text-realdata), NOQUIET, fr->p.flags & MPG123_PLAIN_ID3TEXT); + store_id3_text( &xcom->text, encoding, text, realsize-(text-realdata) + , NOQUIET, fr->p.flags & MPG123_PLAIN_ID3TEXT ); /* Remember: I will probably decode the above (again) for rva comment checking. So no messing around, please. */ if(VERBOSE4) /* Do _not_ print the verbatim text: The encoding might be funny! */ @@ -641,7 +645,8 @@ static void process_comment(mpg123_handle *fr, enum frame_types tt, unsigned cha if((rva_mode > -1) && (fr->rva.level[rva_mode] <= rva_level)) { /* Only translate the contents in here where we really need them. */ - store_id3_text(&localcom.text, text-1, realsize+1-(text-realdata), NOQUIET, 0); + store_id3_text( &localcom.text, encoding, text, realsize-(text-realdata) + , NOQUIET, 0 ); if(localcom.text.fill > 0) { fr->rva.gain[rva_mode] = (float) atof(localcom.text.p); @@ -689,7 +694,7 @@ static void process_extra(mpg123_handle *fr, unsigned char* realdata, size_t rea mpg123_init_string(&description); /* The outside storage gets reencoded to UTF-8 only if not requested otherwise. Remember that we really need the -1 here to hand in the encoding byte!*/ - store_id3_text( &description, descr-1, text-descr+1 + store_id3_text( &description, encoding, descr, text-descr , NOQUIET, fr->p.flags & MPG123_PLAIN_ID3TEXT ); xex = add_extra(fr, &description); if(xex) @@ -706,10 +711,10 @@ static void process_extra(mpg123_handle *fr, unsigned char* realdata, size_t rea init_mpg123_text(&localex); /* For our local copy. */ /* Our local copy is always stored in UTF-8! */ - store_id3_text(&localex.description, descr-1, text-descr+1, NOQUIET, 0); + store_id3_text(&localex.description, encoding, descr, text-descr, NOQUIET, 0); /* At first, only store the outside copy of the payload. We may not need the local copy. */ - text[-1] = encoding; - store_id3_text(&xex->text, text-1, realsize-(text-realdata)+1, NOQUIET, fr->p.flags & MPG123_PLAIN_ID3TEXT); + store_id3_text( &xex->text, encoding, text, realsize-(text-realdata) + , NOQUIET, fr->p.flags & MPG123_PLAIN_ID3TEXT ); /* Now check if we would like to interpret this extra info for RVA. */ if(localex.description.fill > 0) @@ -737,7 +742,8 @@ static void process_extra(mpg123_handle *fr, unsigned char* realdata, size_t rea if((rva_mode > -1) && (fr->rva.level[rva_mode] <= rva_level)) { /* Now we need the translated copy of the data. */ - store_id3_text(&localex.text, text-1, realsize-(text-realdata)+1, NOQUIET, 0); + store_id3_text( &localex.text, encoding, text, realsize-(text-realdata) + , NOQUIET, 0 ); if(localex.text.fill > 0) { if(is_peak) diff --git a/src/version.h b/src/version.h index 0bfed2c..d7f466c 100644 --- a/src/version.h +++ b/src/version.h @@ -16,7 +16,7 @@ // only single spaces as separator to ease parsing by build scripts #define MPG123_MAJOR 1 #define MPG123_MINOR 33 -#define MPG123_PATCH 1 +#define MPG123_PATCH 2 // Don't get too wild with that to avoid confusing m4. No brackets. // Also, it should fit well into a sane file name for the tarball. #define MPG123_SUFFIX ""