]> granicus.if.org Git - libass/commitdiff
Up size limit for script files
authorGrigori Goronzy <greg@blackbox>
Mon, 18 Jan 2010 23:42:22 +0000 (00:42 +0100)
committerGrigori Goronzy <greg@blackbox>
Mon, 18 Jan 2010 23:56:52 +0000 (00:56 +0100)
Change size limit from 10MB to 50MB and clean up code a bit. A limit
still might be handy if one selects a very big file for subtitles by
accident. 50MB should be enough for even the biggest karaoke files.

libass/ass.c

index 5f49a191517c140e16f735e1700477a620de451c..fd63d96a8dfa1791f2c26da3ab2f6670315064f5 100644 (file)
@@ -58,6 +58,7 @@ struct parser_priv {
 
 #define ASS_STYLES_ALLOC 20
 #define ASS_EVENTS_ALLOC 200
+#define ASS_MAX_FILESIZE 50 * 1048576
 
 void ass_free_track(ASS_Track *track)
 {
@@ -1021,10 +1022,10 @@ static char *read_file(ASS_Library *library, char *fname, size_t *bufsize)
     sz = ftell(fp);
     rewind(fp);
 
-    if (sz > 10 * 1024 * 1024) {
+    if (sz > ASS_MAX_FILESIZE) {
         ass_msg(library, MSGL_INFO,
                "ass_read_file(%s): Refusing to load subtitles "
-               "larger than 10MiB", fname);
+               "larger than %d bytes", fname, ASS_MAX_FILESIZE);
         fclose(fp);
         return 0;
     }