diff --git a/cmake/external_libs/libtiff.cmake b/cmake/external_libs/libtiff.cmake index 74984394497..34c397a554c 100644 --- a/cmake/external_libs/libtiff.cmake +++ b/cmake/external_libs/libtiff.cmake @@ -30,6 +30,7 @@ mindspore_add_pkg(tiff MD5 ${MD5} CMAKE_OPTION -DCMAKE_BUILD_TYPE=Release -Djbig=OFF -Dlzma=OFF -Djpeg12=OFF -Dzstd=OFF -Dpixarlog=OFF -Dold-jpeg=OFF -Dwebp=OFF -DBUILD_SHARED_LIBS=OFF -Dlibdeflate=OFF - PATCHES ${TOP_DIR}/third_party/patch/libtiff/CVE-2022-0561_and_CVE-2022-0562.patch001) + PATCHES ${TOP_DIR}/third_party/patch/libtiff/CVE-2022-0561_and_CVE-2022-0562.patch001 + PATCHES ${TOP_DIR}/third_party/patch/libtiff/CVE-2022-0908.patch002) message("tiff include = ${tiff_INC}") message("tiff lib = ${tiff_LIB}") diff --git a/third_party/patch/libtiff/CVE-2022-0908.patch002 b/third_party/patch/libtiff/CVE-2022-0908.patch002 new file mode 100644 index 00000000000..8b441bd49cd --- /dev/null +++ b/third_party/patch/libtiff/CVE-2022-0908.patch002 @@ -0,0 +1,15 @@ +diff -Npur libtiff-v4.2.0/libtiff/tif_dirread.c libtiff-v4.2.0-change/libtiff/tif_dirread.c +--- libtiff-v4.2.0/libtiff/tif_dirread.c 2020-12-20 02:44:58.000000000 +0800 ++++ libtiff-v4.2.0-change/libtiff/tif_dirread.c 2022-03-21 19:27:48.016570736 +0800 +@@ -5079,7 +5079,10 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEnt + _TIFFfree(data); + return(0); + } +- _TIFFmemcpy(o,data,(uint32)dp->tdir_count); ++ if (dp->tdir_count > 0 ) ++ { ++ _TIFFmemcpy(o,data,(uint32)dp->tdir_count); ++ } + o[(uint32)dp->tdir_count]=0; + if (data!=0) + _TIFFfree(data);