[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r23139 - Extractor/src/plugins
From: |
gnunet |
Subject: |
[GNUnet-SVN] r23139 - Extractor/src/plugins |
Date: |
Mon, 6 Aug 2012 13:49:03 +0200 |
Author: grothoff
Date: 2012-08-06 13:49:02 +0200 (Mon, 06 Aug 2012)
New Revision: 23139
Modified:
Extractor/src/plugins/mpeg_extractor.c
Log:
avoid scanning through very large non-mpeg files
Modified: Extractor/src/plugins/mpeg_extractor.c
===================================================================
--- Extractor/src/plugins/mpeg_extractor.c 2012-08-06 11:42:18 UTC (rev
23138)
+++ Extractor/src/plugins/mpeg_extractor.c 2012-08-06 11:49:02 UTC (rev
23139)
@@ -54,6 +54,7 @@
char gop_format[256];
int have_gop;
uint64_t fsize;
+ unsigned int fail_count;
if (NULL == (handle = mpeg2_init ()))
return;
@@ -65,12 +66,16 @@
fsize = ec->get_size (ec->cls);
buf = NULL;
have_gop = 0;
+ fail_count = 0;
while (1)
{
state = mpeg2_parse (handle);
switch (state)
{
case STATE_BUFFER:
+ if (fail_count > 16)
+ goto EXIT; /* do not read large non-mpeg files */
+ fail_count++;
if (0 >= (avail = ec->read (ec->cls,
&buf,
16 * 1024)))
@@ -78,6 +83,7 @@
mpeg2_buffer (handle, buf, buf + avail);
break;
case STATE_SEQUENCE:
+ fail_count = 0;
format[0] = fsize;
format[0]++;
ADD ("video/mpeg", EXTRACTOR_METATYPE_MIMETYPE);
@@ -116,6 +122,7 @@
}
break;
case STATE_GOP:
+ fail_count = 0;
if ( (NULL != info->gop) &&
(0 != info->gop->pictures) )
{
@@ -128,8 +135,10 @@
}
break;
case STATE_SLICE:
+ fail_count = 0;
break;
case STATE_END:
+ fail_count = 0;
break;
case STATE_INVALID:
goto EXIT;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r23139 - Extractor/src/plugins,
gnunet <=