[xiph-cvs] cvs commit: vorbis-tools/oggenc oggenc.c
Michael Smith
msmith at xiph.org
Tue Dec 4 00:20:40 PST 2001
msmith 01/12/04 00:20:39
Modified: oggenc oggenc.c
Log:
Fix segfault on bad input on stdin.
Revision Changes Path
1.33 +8 -2 vorbis-tools/oggenc/oggenc.c
Index: oggenc.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/oggenc/oggenc.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- oggenc.c 2001/10/02 03:03:42 1.32
+++ oggenc.c 2001/12/04 08:20:39 1.33
@@ -97,6 +97,8 @@
if(!strcmp(infiles[i], "-") && numfiles > 1)
{
fprintf(stderr, "ERROR: Multiple files specified when using stdin\n");
+ for(i=0; i < numfiles; i++)
+ fprintf(stderr, "%d: %s\n", i, infiles[i]);
exit(1);
}
}
@@ -193,7 +195,7 @@
if(!foundformat)
{
- fprintf(stderr, "ERROR: Input file \"%s\" is not a supported format\n", infiles[i]);
+ fprintf(stderr, "ERROR: Input file \"%s\" is not a supported format\n", infiles[i]?infiles[i]:"(stdin)");
if(closein)
fclose(in);
errors++;
@@ -225,7 +227,7 @@
strcpy(out_fn, title);
strcat(out_fn, ".ogg");
}
- else
+ else if(infiles[i])
{
/* Create a filename from existing filename, replacing extension with .ogg */
char *start, *end;
@@ -239,6 +241,10 @@
out_fn[end-start] = 0;
strcat(out_fn, ".ogg");
}
+ else {
+ fprintf(stderr, "WARNING: No filename, defaulting to \"default.ogg\"\n");
+ out_fn = strdup("default.ogg");
+ }
out = fopen(out_fn, "wb");
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list