[xiph-commits] r3962 - in itext: . javascript

silvia at svn.annodex.net silvia at svn.annodex.net
Tue Jul 21 00:07:20 PDT 2009


Author: silvia
Date: 2009-07-21 00:07:20 -0700 (Tue, 21 Jul 2009)
New Revision: 3962

Modified:
   itext/
   itext/javascript/subtitles.js
Log:
Added a regex to remove html markup from srt - to avoid security issues.



Property changes on: itext
___________________________________________________________________
Modified: bzr:revision-info
   - timestamp: 2009-07-18 23:16:44.624000072 +1000
committer: Silvia Pfeiffer <silvia.pfeiffer at vquence.com>
properties: 
	branch-nick: silvia

   + timestamp: 2009-07-19 10:21:19.974999905 +1000
committer: Silvia Pfeiffer <silvia.pfeiffer at vquence.com>
properties: 
	branch-nick: silvia

Modified: bzr:revision-id:v4
   - 1 silvia.pfeiffer at vquence.com-20090713110521-cz7evclxohf4rbs2
2 silvia.pfeiffer at vquence.com-20090714003359-apmpuor2ttarph5n
3 silvia.pfeiffer at vquence.com-20090714143931-q6j8ritt91jn5rhu
4 silvia.pfeiffer at vquence.com-20090718094222-58zgcmsg9gggbnt1
5 silvia.pfeiffer at vquence.com-20090718094708-wb83p9u6jr1xlhm6
6 silvia.pfeiffer at vquence.com-20090718095409-p6en5qufj62m8w3h
7 silvia.pfeiffer at vquence.com-20090718113424-9s8cmt1guxj6qoky
8 silvia.pfeiffer at vquence.com-20090718113445-n0q9c14w4i11pe36
9 silvia.pfeiffer at vquence.com-20090718123622-xdp52y76dvpem2ya
10 silvia.pfeiffer at vquence.com-20090718131644-69y0zml0ccbwc5er

   + 1 silvia.pfeiffer at vquence.com-20090713110521-cz7evclxohf4rbs2
2 silvia.pfeiffer at vquence.com-20090714003359-apmpuor2ttarph5n
3 silvia.pfeiffer at vquence.com-20090714143931-q6j8ritt91jn5rhu
4 silvia.pfeiffer at vquence.com-20090718094222-58zgcmsg9gggbnt1
5 silvia.pfeiffer at vquence.com-20090718094708-wb83p9u6jr1xlhm6
6 silvia.pfeiffer at vquence.com-20090718095409-p6en5qufj62m8w3h
7 silvia.pfeiffer at vquence.com-20090718113424-9s8cmt1guxj6qoky
8 silvia.pfeiffer at vquence.com-20090718113445-n0q9c14w4i11pe36
9 silvia.pfeiffer at vquence.com-20090718123622-xdp52y76dvpem2ya
10 silvia.pfeiffer at vquence.com-20090718131644-69y0zml0ccbwc5er
11 silvia.pfeiffer at vquence.com-20090719002119-ekzto9pc7jqs3gw9

Modified: bzr:text-parents
   - javascript/subtitles.js	silvia.pfeiffer at vquence.com-20090718113424-9s8cmt1guxj6qoky

   + 

Modified: itext/javascript/subtitles.js
===================================================================
--- itext/javascript/subtitles.js	2009-07-21 07:07:14 UTC (rev 3961)
+++ itext/javascript/subtitles.js	2009-07-21 07:07:20 UTC (rev 3962)
@@ -348,7 +348,8 @@
 // Function to parse srt file
 function parseSrt (data) {
 	  var srt = data.replace(/\r+/g,''); // remove dos newlines
-	  srt = srt.replace(/^\s+|\s+$/g,''); // trim white space
+      srt = srt.replace(/^\s+|\s+$/g,''); // trim white space start and end
+	  srt = srt.replace(/<[a-zA-Z\/][^>]*>/g,''); // remove all html tags for security reasons
 	  // get captions
 	  var captions = [];
 	  jQuery.each(srt.split('\n\n'), function(i, caption) {
@@ -372,8 +373,8 @@
 	        // Unrecognized timestring
 	        return;
 	      }
-		  // parse text content
-	      content = s.slice(2).join("<br/>");
+		  // concatenate text lines to html text
+		  content = s.slice(2).join("<br/>");
 	    } else {
 		  // file format error
 	      return;



More information about the commits mailing list