1 Star 0 Fork 8

陈亚强/sox

forked from src-openEuler/sox 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
CVE-2021-33844.patch 1.08 KB
一键复制 编辑 原始数据 按行查看 历史
From: Helmut Grohne <helmut@subdivi.de>
Subject: wav: reject 0 bits per sample to avoid division by zero
Bug: https://sourceforge.net/p/sox/bugs/349/
Bug-Debian: https://bugs.debian.org/1021135
--- a/src/wav.c
+++ b/src/wav.c
@@ -506,7 +506,7 @@
unsigned short wChannels; /* number of channels */
uint32_t dwSamplesPerSecond; /* samples per second per channel */
uint32_t dwAvgBytesPerSec;/* estimate of bytes per second needed */
- uint16_t wBitsPerSample; /* bits per sample */
+ uint16_t wBitsPerSample = 0; /* bits per sample */
uint32_t wFmtSize;
uint16_t wExtSize = 0; /* extended field for non-PCM */
@@ -587,6 +587,11 @@
lsx_readdw(ft, &dwAvgBytesPerSec); /* Average bytes/second */
lsx_readw(ft, &(wav->blockAlign)); /* Block align */
lsx_readw(ft, &wBitsPerSample); /* bits per sample per channel */
+ if (wBitsPerSample == 0)
+ {
+ lsx_fail_errno(ft, SOX_EHDR, "WAV file bits per sample is zero");
+ return SOX_EOF;
+ }
len -= 16;
if (wav->formatTag == WAVE_FORMAT_EXTENSIBLE)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yaqiangchen/sox.git
git@gitee.com:yaqiangchen/sox.git
yaqiangchen
sox
sox
master

搜索帮助