control: forwarded -1 https://sourceforge.net/p/faac/bugs/208/ control: tags -1 +patch
diff --git a/frontend/main.c b/frontend/main.c
index 60f687b..33e39b8 100644
--- a/frontend/main.c
+++ b/frontend/main.c
@@ -806,6 +806,13 @@ int main(int argc, char *argv[])
hEncoder = faacEncOpen(infile->samplerate, infile->channels,
&samplesInput, &maxBytesOutput);
+ if (hEncoder == NULL)
+ {
+ fprintf(stderr, "Couldn't open encoder instance for input file %s\n", audioFileName);
+ wav_close(infile);
+ return 1;
+ }
+
#ifdef HAVE_LIBMP4V2
if (container != MP4_CONTAINER && (ntracks || trackno || artist ||
title || album || year || art ||
diff --git a/libfaac/frame.c b/libfaac/frame.c
index 5c203b2..94887ac 100644
--- a/libfaac/frame.c
+++ b/libfaac/frame.c
@@ -288,7 +288,7 @@ int FAACAPI faacEncSetConfiguration(faacEncHandle hpEncoder,
hEncoder->srInfo->num_cb_short);
/* load channel_map */
- for( i = 0; i < 64; i++ )
+ for( i = 0; i < MAX_CHANNELS; i++ )
hEncoder->config.channel_map[i] = config->channel_map[i];
/* OK */
@@ -303,6 +303,9 @@ faacEncHandle FAACAPI faacEncOpen(unsigned long sampleRate,
unsigned int channel;
faacEncStruct* hEncoder;
+ if (numChannels > MAX_CHANNELS)
+ return NULL;
+
*inputSamples = FRAME_LEN*numChannels;
*maxOutputBytes = (6144/8)*numChannels;
@@ -342,7 +345,7 @@ faacEncHandle FAACAPI faacEncOpen(unsigned long sampleRate,
hEncoder->config.shortctl = SHORTCTL_NORMAL;
/* default channel map is straight-through */
- for( channel = 0; channel < 64; channel++ )
+ for( channel = 0; channel < MAX_CHANNELS; channel++ )
hEncoder->config.channel_map[channel] = channel;
/*
signature.asc
Description: This is a digitally signed message part

