mirror of https://github.com/mpv-player/mpv
vo_sixel: Add checks to prevent null pointer dereferencing.
This commit is contained in:
parent
8ddd4547fc
commit
baf45b3bc9
|
@ -162,7 +162,10 @@ static void dealloc_dithers_and_buffer(struct vo* vo)
|
|||
{
|
||||
struct priv* priv = vo->priv;
|
||||
|
||||
talloc_free(priv->buffer);
|
||||
if (priv->buffer) {
|
||||
talloc_free(priv->buffer);
|
||||
priv->buffer = NULL;
|
||||
}
|
||||
|
||||
if (priv->dither) {
|
||||
sixel_dither_unref(priv->dither);
|
||||
|
@ -296,6 +299,10 @@ static void flip_page(struct vo *vo)
|
|||
{
|
||||
struct priv* priv = vo->priv;
|
||||
|
||||
// Make sure that image and dither are valid before drawing
|
||||
if (priv->buffer == NULL || priv->dither == NULL)
|
||||
return;
|
||||
|
||||
// Go to the offset row and column, then display the image
|
||||
printf(ESC_GOTOXY, priv->top, priv->left);
|
||||
sixel_encode(priv->buffer, priv->width, priv->height,
|
||||
|
|
Loading…
Reference in New Issue