* [PATCH 1/1] sbc: Fix stack overflow read in sbc_crc8.
@ 2018-02-21 19:28 Joshua Kessinger
2018-09-11 8:11 ` Luiz Augusto von Dentz
0 siblings, 1 reply; 2+ messages in thread
From: Joshua Kessinger @ 2018-02-21 19:28 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Joshua Kessinger
When encoding or decoding with JOINT_STEREO and 8 subbands the crc_pos is 88
bits. In this case there are no extra bits which need to be added to the CRC,
but there is still a read 1 byte past the end of the crc_header stack variable.
Signed-off-by: Joshua Kessinger <jkessinger@google.com>
---
sbc/sbc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sbc/sbc.c b/sbc/sbc.c
index 606f11c..7f1efaa 100644
--- a/sbc/sbc.c
+++ b/sbc/sbc.c
@@ -190,7 +190,7 @@ static uint8_t sbc_crc8(const uint8_t *data, size_t len)
for (i = 0; i < len / 8; i++)
crc = crc_table[crc ^ data[i]];
- octet = data[i];
+ octet = len % 8 ? data[i] : 0;
for (i = 0; i < len % 8; i++) {
char bit = ((octet ^ crc) & 0x80) >> 7;
--
2.16.1.291.g4437f3f132-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1] sbc: Fix stack overflow read in sbc_crc8.
2018-02-21 19:28 [PATCH 1/1] sbc: Fix stack overflow read in sbc_crc8 Joshua Kessinger
@ 2018-09-11 8:11 ` Luiz Augusto von Dentz
0 siblings, 0 replies; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2018-09-11 8:11 UTC (permalink / raw)
To: Joshua Kessinger; +Cc: linux-bluetooth@vger.kernel.org
Hi Joshua,
On Wed, Feb 21, 2018 at 9:28 PM, Joshua Kessinger <jkessinger@google.com> wrote:
> When encoding or decoding with JOINT_STEREO and 8 subbands the crc_pos is 88
> bits. In this case there are no extra bits which need to be added to the CRC,
> but there is still a read 1 byte past the end of the crc_header stack variable.
>
> Signed-off-by: Joshua Kessinger <jkessinger@google.com>
> ---
> sbc/sbc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sbc/sbc.c b/sbc/sbc.c
> index 606f11c..7f1efaa 100644
> --- a/sbc/sbc.c
> +++ b/sbc/sbc.c
> @@ -190,7 +190,7 @@ static uint8_t sbc_crc8(const uint8_t *data, size_t len)
> for (i = 0; i < len / 8; i++)
> crc = crc_table[crc ^ data[i]];
>
> - octet = data[i];
> + octet = len % 8 ? data[i] : 0;
> for (i = 0; i < len % 8; i++) {
> char bit = ((octet ^ crc) & 0x80) >> 7;
>
> --
Looks like we forgot about this one, it is now applied after removing
the signed-off-by line.
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-09-11 8:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-21 19:28 [PATCH 1/1] sbc: Fix stack overflow read in sbc_crc8 Joshua Kessinger
2018-09-11 8:11 ` Luiz Augusto von Dentz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).