Change in libosmocore[master]: coding: gsm0503: tch_*_decode: Return negative value in error case

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Thu Jul 19 11:57:19 UTC 2018


Pau Espin Pedrol has uploaded this change for review. ( https://gerrit.osmocom.org/10050


Change subject: coding: gsm0503: tch_*_decode: Return negative value in error case
......................................................................

coding: gsm0503: tch_*_decode: Return negative value in error case

id is positive but it's still returned without the buffer being properly
decoded. As such, it has to be seen as an error and not mask it as a
correctly returned len.

Change-Id: I9a7bb2513e3e6301b0fb7d70acc1a153123311d3
---
M src/coding/gsm0503_coding.c
1 file changed, 4 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/50/10050/1

diff --git a/src/coding/gsm0503_coding.c b/src/coding/gsm0503_coding.c
index b0a8e79..190f9c8 100644
--- a/src/coding/gsm0503_coding.c
+++ b/src/coding/gsm0503_coding.c
@@ -2121,8 +2121,8 @@
 
 	/* Check if indicated codec fits into range of codecs */
 	if (id >= codecs) {
-		/* Codec mode out of range, return id */
-		return id;
+		/* Codec mode out of range, return id as error */
+		return -id;
 	}
 
 	switch ((codec_mode_req) ? codec[*ft] : codec[id]) {
@@ -2522,8 +2522,8 @@
 
 	/* Check if indicated codec fits into range of codecs */
 	if (id >= codecs) {
-		/* Codec mode out of range, return id */
-		return id;
+		/* Codec mode out of range, return id as error */
+		return -id;
 	}
 
 	switch ((codec_mode_req) ? codec[*ft] : codec[id]) {

-- 
To view, visit https://gerrit.osmocom.org/10050
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9a7bb2513e3e6301b0fb7d70acc1a153123311d3
Gerrit-Change-Number: 10050
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180719/c365cbc0/attachment.htm>


More information about the gerrit-log mailing list