rev 19266 - in kde-extras/strigi/trunk/debian: . patches
Sune Vuorela
pusling-guest at alioth.debian.org
Sun Jun 24 16:09:38 UTC 2012
Author: pusling-guest
Date: 2012-06-24 16:09:38 +0000 (Sun, 24 Jun 2012)
New Revision: 19266
Added:
kde-extras/strigi/trunk/debian/patches/id3_crash_fix.diff
Modified:
kde-extras/strigi/trunk/debian/changelog
kde-extras/strigi/trunk/debian/patches/series
Log:
backport a crasher bug and id3 tag fix
Modified: kde-extras/strigi/trunk/debian/changelog
===================================================================
--- kde-extras/strigi/trunk/debian/changelog 2012-06-20 13:02:37 UTC (rev 19265)
+++ kde-extras/strigi/trunk/debian/changelog 2012-06-24 16:09:38 UTC (rev 19266)
@@ -1,3 +1,11 @@
+strigi (0.7.7-3) unstable; urgency=low
+
+ * Team upload
+ * Backport a patch I wrote for upstream to fix a crash when parsing mp3
+ files. (Closes: #678698)
+
+ -- Sune Vuorela <sune at debian.org> Sun, 24 Jun 2012 17:39:53 +0200
+
strigi (0.7.7-2) unstable; urgency=low
* Team upload.
Added: kde-extras/strigi/trunk/debian/patches/id3_crash_fix.diff
===================================================================
--- kde-extras/strigi/trunk/debian/patches/id3_crash_fix.diff (rev 0)
+++ kde-extras/strigi/trunk/debian/patches/id3_crash_fix.diff 2012-06-24 16:09:38 UTC (rev 19266)
@@ -0,0 +1,113 @@
+Author: Sune Vuorela <sune at vuorela.dk>
+Author: Ignacio Serantes <kde at aynoa.net>
+
+
+from upstream:
+git diff f1c837823b6dde8464f46ccb02a2c91eff69bee0..808a3fafc1d89a9b8ec76bbcc5b2514cefa9345d
+
+
+
+diff --git a/libstreamanalyzer/lib/endanalyzers/id3endanalyzer.cpp b/libstreamanalyzer/lib/endanalyzers/id3endanalyzer.cpp
+index d8487b5..0db3728 100644
+--- a/libstreamanalyzer/lib/endanalyzers/id3endanalyzer.cpp
++++ b/libstreamanalyzer/lib/endanalyzers/id3endanalyzer.cpp
+@@ -81,7 +81,9 @@ replaygain
+ VBR detection
+ */
+
+-static const string genres[148] = {
++#define ID3_NUMBER_OF_GENRES 148
++
++static const string genres[ID3_NUMBER_OF_GENRES] = {
+ "Blues",
+ "Classic Rock",
+ "Country",
+@@ -372,6 +374,54 @@ static bool extract_and_trim(const char* buf, int offset, int length, string& s)
+ return !s.empty();
+ }
+
++/**
++ * Functional helper class to get the right numbers out of a 'genre' string which
++ * might be a number in a index
++ */
++class genre_number_parser {
++ private:
++ bool success;
++ long result;
++ void parse_string( string genre ) {
++ char* endptr;
++ int r = strtol(genre.c_str(),&endptr, 10);
++ if(*endptr == '\0') { //to check if the convertion went more or less ok
++ if(r >=0 && r < ID3_NUMBER_OF_GENRES ) { //to ensure it is within the range we have
++ success=true;
++ result=r;
++ }
++ }
++ }
++ public:
++ /**
++ * constructor taking the genre string you want parsed as a number
++ */
++ genre_number_parser(string genre) : success(false), result(-1) {
++ if(genre.size()==0) {
++ //if the string is empty, there is no need to try to parse it
++ return;
++ }
++ //the string might start and end with parenthesis
++ if(genre[0]=='(' && genre[genre.size()-1]==')') {
++ parse_string(genre.substr(1,genre.length()-2));
++ return;
++ }
++ parse_string(genre);
++ }
++ /**
++ * wether or not parsing was successful
++ */
++ operator bool() {
++ return success;
++ }
++ /**
++ * the actual result of the parsing, or -1 if parsing wasn't successful
++ */
++ operator long() {
++ return result;
++ }
++};
++
+ signed char
+ ID3EndAnalyzer::analyze(Strigi::AnalysisResult& indexable, Strigi::InputStream* in) {
+ const int max_padding = 1000;
+@@ -512,13 +562,17 @@ ID3EndAnalyzer::analyze(Strigi::AnalysisResult& indexable, Strigi::InputStream*
+ addStatement(indexable, albumUri, titlePropertyName, value);
+ found_album = true;
+ } else if (strncmp("TCON", p, 4) == 0) {
+- // The Genre is stored as (number)
+- if( value[0] == '(' && value[value.length()-1] == ')' ) {
+- //vHanda: Maybe one should check if all the characters in between are digits
+- int genreIndex = atoi( value.substr( 1, value.length()-1 ).c_str() );
+- indexable.addValue(factory->genreField, genres[ genreIndex ]);
+- found_genre = true;
+- }
++ genre_number_parser p(value);
++ if(p) {
++ indexable.addValue(factory->genreField, genres[ p ]);
++ found_genre = true;
++ } else {
++ // We must not forget that genre could be a string.
++ if (!value.empty()) {
++ indexable.addValue(factory->genreField, value);
++ found_genre = true;
++ }
++ }
+ } else if (strncmp("TLEN", p, 4) == 0) {
+ indexable.addValue(factory->durationField, value);
+ } else if (strncmp("TEXT", p, 4) == 0) {
+@@ -623,7 +677,7 @@ ID3EndAnalyzer::analyze(Strigi::AnalysisResult& indexable, Strigi::InputStream*
+ if (!found_track && !buf[125] && buf[126]) {
+ indexable.addValue(factory->trackNumberField, (int)(buf[126]));
+ }
+- if (!found_genre && (unsigned char)(buf[127]) < 148)
++ if (!found_genre && (unsigned char)(buf[127]) < ID3_NUMBER_OF_GENRES)
+ indexable.addValue(factory->genreField, genres[(uint8_t)buf[127]]);
+ }
+ }
Modified: kde-extras/strigi/trunk/debian/patches/series
===================================================================
--- kde-extras/strigi/trunk/debian/patches/series 2012-06-20 13:02:37 UTC (rev 19265)
+++ kde-extras/strigi/trunk/debian/patches/series 2012-06-24 16:09:38 UTC (rev 19266)
@@ -1 +1,2 @@
upstream_gcc47-fix-unistd.h-header-required-unconditionally-f.patch
+id3_crash_fix.diff
More information about the pkg-kde-commits
mailing list