Mercurial > libavformat.hg
comparison utils.c @ 5293:f18f00a37c22 libavformat
Avoid segfault for empty input files
| author | vitor |
|---|---|
| date | Sat, 17 Oct 2009 20:37:58 +0000 |
| parents | f49b29ab43fc |
| children | 026cc515aad8 |
comparison
equal
deleted
inserted
replaced
| 5292:2568a59ac5fe | 5293:f18f00a37c22 |
|---|---|
| 467 for(probe_size= PROBE_BUF_MIN; probe_size<=PROBE_BUF_MAX && !fmt; probe_size<<=1){ | 467 for(probe_size= PROBE_BUF_MIN; probe_size<=PROBE_BUF_MAX && !fmt; probe_size<<=1){ |
| 468 int score= probe_size < PROBE_BUF_MAX ? AVPROBE_SCORE_MAX/4 : 0; | 468 int score= probe_size < PROBE_BUF_MAX ? AVPROBE_SCORE_MAX/4 : 0; |
| 469 /* read probe data */ | 469 /* read probe data */ |
| 470 pd->buf= av_realloc(pd->buf, probe_size + AVPROBE_PADDING_SIZE); | 470 pd->buf= av_realloc(pd->buf, probe_size + AVPROBE_PADDING_SIZE); |
| 471 pd->buf_size = get_buffer(pb, pd->buf, probe_size); | 471 pd->buf_size = get_buffer(pb, pd->buf, probe_size); |
| 472 | |
| 473 if ((int)pd->buf_size < 0) { | |
| 474 err = pd->buf_size; | |
| 475 goto fail; | |
| 476 } | |
| 477 | |
| 472 memset(pd->buf+pd->buf_size, 0, AVPROBE_PADDING_SIZE); | 478 memset(pd->buf+pd->buf_size, 0, AVPROBE_PADDING_SIZE); |
| 473 if (url_fseek(pb, 0, SEEK_SET) < 0) { | 479 if (url_fseek(pb, 0, SEEK_SET) < 0) { |
| 474 url_fclose(pb); | 480 url_fclose(pb); |
| 475 if (url_fopen(&pb, filename, URL_RDONLY) < 0) { | 481 if (url_fopen(&pb, filename, URL_RDONLY) < 0) { |
| 476 pb = NULL; | 482 pb = NULL; |
