summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShreesh Adiga <16567adigashreesh@gmail.com>2020-11-09 19:53:22 +0530
committerAvi Halachmi (:avih) <avihpit@yahoo.com>2020-11-09 19:44:07 +0200
commitbaf45b3bc99c5c307d0aa52ff83a9a365a054aed (patch)
tree07a144bc38974958ca0bffb220980e81f27e4dcb
parent8ddd4547fc2d3b813c88b586cf8a579bff4afa4f (diff)
downloadmpv-baf45b3bc99c5c307d0aa52ff83a9a365a054aed.tar.bz2
mpv-baf45b3bc99c5c307d0aa52ff83a9a365a054aed.tar.xz
vo_sixel: Add checks to prevent null pointer dereferencing.
-rw-r--r--video/out/vo_sixel.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/video/out/vo_sixel.c b/video/out/vo_sixel.c
index cce6a3da9d..5a5564edc1 100644
--- a/video/out/vo_sixel.c
+++ b/video/out/vo_sixel.c
@@ -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,