linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Siarhei Siamashka <siarhei.siamashka@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Lennart Poettering <lennart@poettering.net>
Subject: SBC encoder/decoder API & errors handling
Date: Tue, 29 Jun 2010 18:45:49 +0000	[thread overview]
Message-ID: <201006291845.53998.siarhei.siamashka@gmail.com> (raw)

[-- Attachment #1: Type: Text/Plain, Size: 1038 bytes --]

Hello,

When I tried to run some SBC encoder tests a few days ago, I noticed that 
there is a regression introduced by commit:
http://git.kernel.org/?p=bluetooth/bluez.git;a=commit;h=c43f8bdcc1d527e2d77481a66217771038be3acd

It is caused by the change from 'int' to 'size_t' for the type of variable 
'encoded' in 'sbcenc.c'. After this modification, the check for 'encoded <= 0' 
does not catch the case when 'sbc_encode' tries to return a negative number in 
'encoded' variable. Later we end up calling 'write' function with a negative 
size for the data block.

Right now, in the case of error 'sbc_encode' function may either return a 
negative number as a return value, or return a negative value in 'encoded' 
variable. But this second type of error is apparently not handled by anything 
other than 'sbcenc' tool at the moment.

Any opinions about how to fix it in the best way? Because it is a flaw in the 
library API, comments from the interested parties are welcome.

-- 
Best regards,
Siarhei Siamashka

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

             reply	other threads:[~2010-06-29 18:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-29 18:45 Siarhei Siamashka [this message]
2010-06-30  7:53 ` SBC encoder/decoder API & errors handling Johan Hedberg
2010-06-30  8:31   ` Luiz Augusto von Dentz
2010-06-30  8:53     ` Johan Hedberg
2010-06-30 13:07       ` Siarhei Siamashka
2010-06-30 11:03         ` Johan Hedberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201006291845.53998.siarhei.siamashka@gmail.com \
    --to=siarhei.siamashka@gmail.com \
    --cc=lennart@poettering.net \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).