1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-09-22 04:15:54 -04:00

Better error messages on some corrupt sources.

svn path=/trunk/icecast/; revision=3796
This commit is contained in:
Michael Smith 2002-08-10 04:51:11 +00:00
parent 5d06975c44
commit e97e404904

View File

@ -16,6 +16,10 @@
#include "stats.h"
#include "format.h"
#define CATMODULE "format-vorbis"
#include "log.h"
#include "logging.h"
#define MAX_HEADER_PAGES 10
typedef struct _vstate_tag
@ -155,17 +159,19 @@ int format_vorbis_get_buffer(format_plugin_t *self, char *data, unsigned long le
}
/* cache header pages */
if (state->header > 0) {
if (state->header > 0 && state->packets < 3) {
if(state->header > MAX_HEADER_PAGES) {
refbuf_release(refbuf);
ERROR1("Bad vorbis input: header is more than %d pages long", MAX_HEADER_PAGES);
return -1;
}
refbuf_addref(refbuf);
state->headbuf[state->header - 1] = refbuf;
if (state->packets >= 0 && state->packets < 2) {
if (state->packets >= 0 && state->packets < 3) {
ogg_stream_pagein(&state->os, &state->og);
while (state->packets < 2) {
while (state->packets < 3) {
result = ogg_stream_packetout(&state->os, &op);
if (result == 0) break; /* need more data */
if (result < 0) {