File Fix-a-couple-buffer-overflows.patch of Package faad2 (Revision 23)
Currently displaying revision 23 , Show latest
41
1
From: =?utf-8?q?Hugo_Beauz=C3=A9e-Luyssen?= <hugo@beauzee.fr>
2
Date: Fri, 7 Jun 2019 20:02:57 +0200
3
Subject: Fix a couple buffer overflows
4
5
https://hackerone.com/reports/502816
6
https://hackerone.com/reports/507858
7
---
8
libfaad/bits.c | 5 ++++-
9
libfaad/syntax.c | 2 ++
10
2 files changed, 6 insertions(+), 1 deletion(-)
11
12
diff --git a/libfaad/bits.c b/libfaad/bits.c
13
index dc14d7a..4c0de24 100644
14
--- a/libfaad/bits.c
15
+++ b/libfaad/bits.c
16
17
int words = bits >> 5;
18
int remainder = bits & 0x1F;
19
20
- ld->bytes_left = ld->buffer_size - words*4;
21
+ if (ld->buffer_size < words * 4)
22
+ ld->bytes_left = 0;
23
+ else
24
+ ld->bytes_left = ld->buffer_size - words*4;
25
26
if (ld->bytes_left >= 4)
27
{
28
diff --git a/libfaad/syntax.c b/libfaad/syntax.c
29
index e7fb113..c992543 100644
30
--- a/libfaad/syntax.c
31
+++ b/libfaad/syntax.c
32
33
while ((drc->additional_excluded_chns[n-1] = faad_get1bit(ld
34
DEBUGVAR(1,104,"excluded_channels(): additional_excluded_chns"))) == 1)
35
{
36
+ if (i >= MAX_CHANNELS - num_excl_chan - 7)
37
+ return n;
38
for (i = num_excl_chan; i < num_excl_chan+7; i++)
39
{
40
drc->exclude_mask[i] = faad_get1bit(ld
41