aboutsummaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorAleksander Morgado <aleksandermj@chromium.org>2023-03-30 21:30:54 +0000
committerAleksander Morgado <aleksandermj@chromium.org>2023-03-30 22:07:45 +0000
commit6dccfc5abd4fe8af29210449ce2a78546633bdd1 (patch)
treeaf887416531e5bd002a299f6b5e8692c0824f966 /src/tests
parentfae6d20ed0e8bc98dcffd6c15c2fc1395f9edfbc (diff)
sms-part-cdma: fix warning when attempting g_convert() with NULL input
GLib-CRITICAL **: 21:21:51.419: g_convert: assertion 'str != NULL' failed Program received signal SIGTRAP, Trace/breakpoint trap. 0x00007ffff7db3e82 in g_logv () from /lib/x86_64-linux-gnu/libglib-2.0.so.0 (gdb) bt #0 0x00007ffff7db3e82 in g_logv () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #1 0x00007ffff7db40ef in g_log () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #2 0x00007ffff7d8a5da in g_convert () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #3 0x00005555555592cf in read_bearer_data_user_data (log_object=0x0, subparameter=<optimized out>, sms_part=0x555555578000) at ../src/mm-sms-part-cdma.c:929 #4 read_bearer_data (log_object=0x0, parameter=<optimized out>, sms_part=0x555555578000) at ../src/mm-sms-part-cdma.c:982 #5 mm_sms_part_cdma_new_from_binary_pdu
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/test-sms-part-cdma.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/tests/test-sms-part-cdma.c b/src/tests/test-sms-part-cdma.c
index eb095f34..935a9c6b 100644
--- a/src/tests/test-sms-part-cdma.c
+++ b/src/tests/test-sms-part-cdma.c
@@ -348,6 +348,28 @@ test_unicode_encoding (void)
"中國哲學書電子化計劃");
}
+static void
+test_empty_unicode_user_data (void)
+{
+ static const guint8 pdu[] = {
+ 0x01, 0x08, 0x2f, 0x03, 0x01, 0x00, 0x00, 0x00,
+ 0xfd, 0x00, 0x01, 0x02, 0x08, 0x00, 0x01, 0x02,
+ 0x00, 0x00, 0x01, 0x02, 0x20, 0x01, 0x02, 0x00,
+ 0x00, 0x00, 0x47, 0x06, 0x01, 0x02, 0x00, 0x06,
+ 0x08, 0x08, 0x05, 0x01, 0x06, 0x01, 0x6d, 0x38,
+ 0x00, 0x03, 0x05, 0x01, 0x06, 0x01, 0x02, 0x00,
+ 0x06, 0x08, 0x08, 0x05, 0x01, 0x00, 0x00, 0x00,
+ 0x47, 0x06, 0x01, 0x02, 0x00, 0x06, 0x08, 0x08,
+ 0x05, 0x01, 0x06, 0x01, 0x6d, 0x38, 0x00, 0x03,
+ 0x05, 0x01, 0x06, 0x01, 0x02, 0x00, 0x06, 0x08,
+ 0x08, 0x05, 0x01, 0x06, 0x06, 0x00, 0x01, 0x00,
+ 0x34, 0x00, 0x03, 0x05, 0x29, 0x08, 0x08, 0x05,
+ 0x01, 0xb6, 0x01, 0x38, 0x00, 0x02, 0x02, 0x00 };
+
+ /* also invalid this one */
+ common_test_invalid_part_from_pdu (pdu, sizeof (pdu));
+}
+
/********************* PDU CREATOR TESTS *********************/
static void
@@ -553,6 +575,7 @@ int main (int argc, char **argv)
g_test_add_func ("/MM/SMS/CDMA/PDU-Parser/latin-encoding", test_latin_encoding);
g_test_add_func ("/MM/SMS/CDMA/PDU-Parser/latin-encoding-2", test_latin_encoding_2);
g_test_add_func ("/MM/SMS/CDMA/PDU-Parser/unicode-encoding", test_unicode_encoding);
+ g_test_add_func ("/MM/SMS/CDMA/PDU-Parser/empty-unicode-user-data", test_empty_unicode_user_data);
g_test_add_func ("/MM/SMS/CDMA/PDU-Creator/ascii-encoding", test_create_pdu_text_ascii_encoding);
g_test_add_func ("/MM/SMS/CDMA/PDU-Creator/latin-encoding", test_create_pdu_text_latin_encoding);