Permalink
Browse files

Prevent stack overflow with LiveTV on Mac OS X, by allocating buffer …

…from heap.

Thanks to Christoph Rudorff. Refs #6211. Refs #8179.
Tidier solution than trunk's [24618]?


git-svn-id: http://svn.mythtv.org/svn/branches/release-0-23-fixes@25295 7dbf422c-18fa-0310-86e9-fd20926502f2
  • Loading branch information...
1 parent ce01b25 commit d547b25f264d74b891ac0dd216e0c193e4dee73d @NigelPearson NigelPearson committed Jul 8, 2010
Showing with 7 additions and 2 deletions.
  1. +7 −2 mythtv/libs/libmythtv/NuppelVideoPlayer.cpp
@@ -1182,7 +1182,7 @@ int NuppelVideoPlayer::OpenFile(bool skipDsp, uint retries,
}
player_ctx->buffer->Start();
- char testbuf[kDecoderProbeBufferSize];
+ char *testbuf = new char[kDecoderProbeBufferSize];
player_ctx->buffer->Unpause(); // so we can read testbuf if we were paused
// delete any pre-existing recorder
@@ -1196,6 +1196,7 @@ int NuppelVideoPlayer::OpenFile(bool skipDsp, uint retries,
VERBOSE(VB_IMPORTANT,
QString("NVP::OpenFile(): Error, couldn't read file: %1")
.arg(player_ctx->buffer->GetFilename()));
+ delete [] testbuf;
return -1;
}
@@ -1222,13 +1223,14 @@ int NuppelVideoPlayer::OpenFile(bool skipDsp, uint retries,
VERBOSE(VB_IMPORTANT, LOC_ERR +
QString("Couldn't find an A/V decoder for: '%1'")
.arg(player_ctx->buffer->GetFilename()));
-
+ delete [] testbuf;
return -1;
}
else if (GetDecoder()->IsErrored())
{
VERBOSE(VB_IMPORTANT, LOC_ERR + "Could not initialize A/V decoder.");
SetDecoder(NULL);
+ delete [] testbuf;
return -1;
}
@@ -1252,6 +1254,7 @@ int NuppelVideoPlayer::OpenFile(bool skipDsp, uint retries,
{
VERBOSE(VB_IMPORTANT, QString("Couldn't open decoder for: %1")
.arg(player_ctx->buffer->GetFilename()));
+ delete [] testbuf;
return -1;
}
@@ -1276,6 +1279,8 @@ int NuppelVideoPlayer::OpenFile(bool skipDsp, uint retries,
bookmarkseek = GetBookmark();
+ delete [] testbuf;
+
return IsErrored() ? -1 : 0;
}

0 comments on commit d547b25

Please sign in to comment.