$NetBSD: patch-ac,v 1.10 2015/03/21 19:06:54 bsiegert Exp $ https://trac.xiph.org/changeset/19117 oggenc: fix crash on raw file close, reported by Hanno in issue #2009. pointer to a non-static struct was escaping its scope. --- oggenc/oggenc.c.orig 2010-03-26 07:07:07.000000000 +0000 +++ oggenc/oggenc.c @@ -97,6 +97,8 @@ int main(int argc, char **argv) .3,-1, 0,0,0.f, 0, 0, 0, 0, 0}; + input_format raw_format = {NULL, 0, raw_open, wav_close, "raw", + N_("RAW file reader")}; int i; @@ -239,9 +241,6 @@ int main(int argc, char **argv) if(opt.rawmode) { - input_format raw_format = {NULL, 0, raw_open, wav_close, "raw", - N_("RAW file reader")}; - enc_opts.rate=opt.raw_samplerate; enc_opts.channels=opt.raw_channels; enc_opts.samplesize=opt.raw_samplesize; @@ -779,6 +778,8 @@ static void parse_options(int argc, char break; case 'a': + if (strlen(optarg) == 0) + break; opt->artist = realloc(opt->artist, (++opt->artist_count)*sizeof(char *)); opt->artist[opt->artist_count - 1] = strdup(optarg); break; @@ -791,10 +792,14 @@ static void parse_options(int argc, char opt->comments[opt->comment_count - 1] = strdup(optarg); break; case 'd': + if (strlen(optarg) == 0) + break; opt->dates = realloc(opt->dates, (++opt->date_count)*sizeof(char *)); opt->dates[opt->date_count - 1] = strdup(optarg); break; case 'G': + if (strlen(optarg) == 0) + break; opt->genre = realloc(opt->genre, (++opt->genre_count)*sizeof(char *)); opt->genre[opt->genre_count - 1] = strdup(optarg); break; @@ -803,6 +808,8 @@ static void parse_options(int argc, char exit(0); break; case 'l': + if (strlen(optarg) == 0) + break; opt->album = realloc(opt->album, (++opt->album_count)*sizeof(char *)); opt->album[opt->album_count - 1] = strdup(optarg); break; @@ -815,6 +822,8 @@ static void parse_options(int argc, char opt->fixedserial = 1; break; case 't': + if (strlen(optarg) == 0) + break; opt->title = realloc(opt->title, (++opt->title_count)*sizeof(char *)); opt->title[opt->title_count - 1] = strdup(optarg); break;