changeset 586:b21ea4ab586d

libgsmhr1: update for TW-TS-002 version 1.2.0 The component of libgsmhr1 being changed is RTP input functions; the change is accepting FT=1 (invalid SID) frames both with and without payload data bits.
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 10 Mar 2025 02:03:31 +0000
parents 3c6bf0d26ee7
children 7bce90c844c2
files libgsmhr1/rtp_in.c libgsmhr1/rtp_in_direct.c
diffstat 2 files changed, 36 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libgsmhr1/rtp_in.c	Tue Feb 25 07:49:28 2025 +0000
+++ b/libgsmhr1/rtp_in.c	Mon Mar 10 02:03:31 2025 +0000
@@ -28,11 +28,17 @@
 		if (rtp_in[0] & 0x80)
 			goto bad_rtp_input;
 		ft = rtp_in[0] >> 4;
-		if (ft == 1 || ft == 7) {
+		switch (ft) {
+		case 1:
+			if (rtp_in[0] & 0x04)
+				goto bad_rtp_input;
+			/* FALL THRU */
+		case 7:
 			canon_pl[0] = rtp_in[0];
 			return 0;
-		} else
+		default:
 			goto bad_rtp_input;
+		}
 	case GSMHR_FRAME_LEN_RPF:
 		/*
 		 * The length is that of a TS 101 318 payload.
@@ -53,11 +59,19 @@
 		if (rtp_in[0] & 0x80)
 			goto bad_rtp_input;
 		ft = rtp_in[0] >> 4;
-		if (ft == 0 || ft == 2 || ft == 6) {
+		switch (ft) {
+		case 1:
+			if (!(rtp_in[0] & 0x04))
+				goto bad_rtp_input;
+			/* FALL THRU */
+		case 0:
+		case 2:
+		case 6:
 			memcpy(canon_pl, rtp_in, GSMHR_FRAME_LEN_5993);
 			return 0;
-		} else
+		default:
 			goto bad_rtp_input;
+		}
 	default:
 	bad_rtp_input:
 		/*
--- a/libgsmhr1/rtp_in_direct.c	Tue Feb 25 07:49:28 2025 +0000
+++ b/libgsmhr1/rtp_in_direct.c	Mon Mar 10 02:03:31 2025 +0000
@@ -39,11 +39,17 @@
 		if (rtp_in[0] & 0x80)
 			goto bad_rtp_input;
 		ft = rtp_in[0] >> 4;
-		if (ft == 1 || ft == 7) {
+		switch (ft) {
+		case 1:
+			if (rtp_in[0] & 0x04)
+				goto bad_rtp_input;
+			/* FALL THRU */
+		case 7:
 			gsmhr_decoder_twts002_in(rtp_in, params);
 			return 0;
-		} else
+		default:
 			goto bad_rtp_input;
+		}
 	case GSMHR_FRAME_LEN_RPF:
 		/*
 		 * The length is that of a TS 101 318 payload.
@@ -67,11 +73,19 @@
 		if (rtp_in[0] & 0x80)
 			goto bad_rtp_input;
 		ft = rtp_in[0] >> 4;
-		if (ft == 0 || ft == 2 || ft == 6) {
+		switch (ft) {
+		case 1:
+			if (!(rtp_in[0] & 0x04))
+				goto bad_rtp_input;
+			/* FALL THRU */
+		case 0:
+		case 2:
+		case 6:
 			gsmhr_decoder_twts002_in(rtp_in, params);
 			return 0;
-		} else
+		default:
 			goto bad_rtp_input;
+		}
 	default:
 	bad_rtp_input:
 		/*