[MPlayer-dev-eng] [patch] fix segfault in vf_screensaver
Bas Zoetekouw
bas at debian.org
Mon Dec 24 17:39:02 CET 2007
Hi!
[please cc me, I'n not subscribed]
The attached patch fixes a segfault in vf_screensaver that is triggered
if the PNG encoder can't be found.
The fact that the encoder can't be found is a separate bug, I think,
which only started to occur on my system rather recently, and which I
can't seem to trigger outside of mplayer. I'm still trying to hunt it
down.
Please let me know if you have any comments on the patch, or if you
have ideas on why avcodec_find_encoder(CODEC_ID_PNG) might return NULL
onm my system.
Best regards (and a merry Christmas!)
Bas.
--
+----------------------------------------------------------------------+
| Bas Zoetekouw | Sweet day, so cool, so calm, so bright, |
|----------------------------| The bridall of the earth and skie: |
| bas at zoetekouw.net | The dew shall weep thy fall tonight; |
+----------------------------| For thou must die. |
+-----------------------------------------+
-------------- next part --------------
Index: libmpcodecs/vf_screenshot.c
===================================================================
--- libmpcodecs/vf_screenshot.c (revision 25523)
+++ libmpcodecs/vf_screenshot.c (working copy)
@@ -264,6 +264,8 @@
// open conflicts with stdio.h at least under MinGW
static int screenshot_open(vf_instance_t *vf, char* args)
{
+ AVCodec *the_codec;
+
vf->config=config;
vf->control=control;
vf->put_image=put_image;
@@ -280,8 +282,10 @@
vf->priv->outbuffer=0;
vf->priv->ctx=0;
vf->priv->avctx = avcodec_alloc_context();
+
avcodec_register_all();
- if (avcodec_open(vf->priv->avctx, avcodec_find_encoder(CODEC_ID_PNG))) {
+ the_codec = avcodec_find_encoder(CODEC_ID_PNG);
+ if ( the_codec == NULL || avcodec_open(vf->priv->avctx, the_codec)) {
mp_msg(MSGT_VFILTER, MSGL_FATAL, "Could not open libavcodec PNG encoder\n");
return 0;
}
More information about the MPlayer-dev-eng
mailing list