diff options
author | Matti Niemenmaa | 2016-07-09 20:40:56 +0300 |
---|---|---|
committer | Matti Niemenmaa | 2016-07-09 20:40:56 +0300 |
commit | 990640b5a10a97f6fdf0dec61036ccbeba0e8eb2 (patch) | |
tree | 9322847cad985897c7f22282ca87b29b02c1e47e /integer-overflow.patch | |
parent | fc8dbc87110068b9588047713487a1a24ffd006e (diff) | |
download | aur-990640b5a10a97f6fdf0dec61036ccbeba0e8eb2.tar.gz |
Hackily patch some integer overflow issues
I ran into a situation where one of these multiplications overflowed,
resulting in eventual memory corruption and similar fun things. Using
longs should mitigate the issue but may or may not actually fix it.
Diffstat (limited to 'integer-overflow.patch')
-rw-r--r-- | integer-overflow.patch | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/integer-overflow.patch b/integer-overflow.patch new file mode 100644 index 000000000000..bbd8fa6c97d2 --- /dev/null +++ b/integer-overflow.patch @@ -0,0 +1,22 @@ +diff --git jni/mdxmini/src/mdxmini.c jni/mdxmini/src/mdxmini.c +index a5bb8e3..3a07c26 100755 +--- jni/mdxmini/src/mdxmini.c ++++ jni/mdxmini/src/mdxmini.c +@@ -276,7 +276,7 @@ int mdx_calc_sample(t_mdxmini *data, short *buf, int buffer_size) + frame = mdx_frame_length(data); + + // 生成可能サンプル数 +- data->samples += (data->mdx->dsp_speed * frame)/1000000; ++ data->samples += ((long)data->mdx->dsp_speed * (long)frame)/1000000; + } + + int len = data->samples; +@@ -324,7 +324,7 @@ int mdx_calc_log(t_mdxmini *data, short *buf, int buffer_size) + #endif + next = mdx_next_frame(data); + frame = mdx_frame_length(data); +- data->samples = (data->mdx->dsp_speed * frame)/1000000; ++ data->samples = ((long)data->mdx->dsp_speed * (long)frame)/1000000; + } + + int calc_len = data->samples; |