The Mayhem test case can be generalized: wvgain crashes whenever given
an invalid filename (file doesn't exist) and the "-n" option. This is
due to a call to WavpackCloseFile(..) with a NULL pointer as file
handle. Proposing the attached patch.
Patch has been sent to upstream, too:
http://www.hydrogenaud.io/forums/index.php?showtopic=106606
Cheers,
Martin
Description: Fix segmentation fault with invalid filename and -N option
Make sure the function WavpackCloseFile(..) is only called on valid
file handles, after having successfully opened the file.
Author: Martin Steghöfer <mar...@steghoefer.eu>
Forwarded: http://www.hydrogenaud.io/forums/index.php?showtopic=106606
--- a/cli/wvgain.c
+++ b/cli/wvgain.c
@@ -365,21 +365,22 @@
wpc = WavpackOpenFileInput (matches [file_index], error, OPEN_TAGS, 0);
- if (wpc && WavpackGetTagItem (wpc, album_mode ? "replaygain_album_gain" : "replaygain_track_gain", NULL, 0)) {
+ if (wpc) {
+ int alreadyHasTag = WavpackGetTagItem (wpc, album_mode ? "replaygain_album_gain" : "replaygain_track_gain", NULL, 0);
WavpackCloseFile (wpc);
- if (album_mode) {
- error_line ("ReplayGain album information already present...aborting");
- result = HARD_ERROR;
- break;
- }
- else {
- error_line ("ReplayGain track information already present...skipping");
- continue;
+ if (alreadyHasTag) {
+ if (album_mode) {
+ error_line ("ReplayGain album information already present...aborting");
+ result = HARD_ERROR;
+ break;
+ }
+ else {
+ error_line ("ReplayGain track information already present...skipping");
+ continue;
+ }
}
}
-
- WavpackCloseFile (wpc);
}
result = analyze_file (matches [file_index], track_histogram, &track_peak);
_______________________________________________
pkg-multimedia-maintainers mailing list
pkg-multimedia-maintainers@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-multimedia-maintainers