From ebc4939dd235f3cdc8a69182426bd94cfece4cf0 Mon Sep 17 00:00:00 2001
From: Jan Pavlinec <jan.pavlinec@nic.cz>
Date: Wed, 10 Mar 2021 13:10:58 +0100
Subject: [PATCH] zstd: update to version 1.4.9

Fixes CVE-2021-24032

Signed-off-by: Jan Pavlinec <jan.pavlinec@nic.cz>
---
 utils/zstd/Makefile                    |  4 ++--
 utils/zstd/patches/001-fix-meson.patch | 11 +++++++++++
 2 files changed, 13 insertions(+), 2 deletions(-)
 create mode 100644 utils/zstd/patches/001-fix-meson.patch

diff --git a/utils/zstd/Makefile b/utils/zstd/Makefile
index c25a2f231..254967919 100644
--- a/utils/zstd/Makefile
+++ b/utils/zstd/Makefile
@@ -1,12 +1,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=zstd
-PKG_VERSION:=1.4.8
+PKG_VERSION:=1.4.9
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.zst
 PKG_SOURCE_URL:=https://github.com/facebook/zstd/releases/download/v$(PKG_VERSION)
-PKG_HASH:=c7ea10e20dd61b457220455e3cf553069987b968b7c63d1b9d46acbdb45623eb
+PKG_HASH:=61dce0e9a5036d7fb9b5709ee6567c2c8a1b4ba48a8e43afe9ae355cc37bb494
 
 PKG_MAINTAINER:=
 PKG_LICENSE:=GPL-2.0-or-later
diff --git a/utils/zstd/patches/001-fix-meson.patch b/utils/zstd/patches/001-fix-meson.patch
new file mode 100644
index 000000000..f9a69d049
--- /dev/null
+++ b/utils/zstd/patches/001-fix-meson.patch
@@ -0,0 +1,11 @@
+Fixes build issue https://github.com/facebook/zstd/issues/2519
+--- a/build/meson/lib/meson.build
++++ b/build/meson/lib/meson.build
+@@ -22,6 +22,7 @@ libzstd_sources = [join_paths(zstd_rootd
+   join_paths(zstd_rootdir, 'lib/common/threading.c'),
+   join_paths(zstd_rootdir, 'lib/common/pool.c'),
+   join_paths(zstd_rootdir, 'lib/common/zstd_common.c'),
++  join_paths(zstd_rootdir, 'lib/common/zstd_trace.c'),
+   join_paths(zstd_rootdir, 'lib/common/error_private.c'),
+   join_paths(zstd_rootdir, 'lib/common/xxhash.c'),
+   join_paths(zstd_rootdir, 'lib/compress/hist.c'),