Change in gapk[master]: fmt_ti.c: fix: properly pre-clean the output buffer

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/.

Vadim Yanitskiy gerrit-no-reply at lists.osmocom.org
Sat Jun 30 14:23:18 UTC 2018


Vadim Yanitskiy has uploaded this change for review. ( https://gerrit.osmocom.org/9794


Change subject: fmt_ti.c: fix: properly pre-clean the output buffer
......................................................................

fmt_ti.c: fix: properly pre-clean the output buffer

Despite it was stated that only the last nibble isn't being
written, some other bytes in the middle of the output buffer
were uninitialized during the first exectution of a queue.

The problem was observed with AddressSanitizer enabled.

Valgrind output:

  $ valgrind --track-origins=yes \
      src/.libs/lt-osmo-gapk \
      -i tests/ref-files/hhgttg_part1_5.s16.ti-efr \
      -f ti-efr -g rawpcm-s16le \
      -o /dev/null -v

 Conditional jump or move depends on uninitialised value(s)
    at 0x52728F2: msb_put_bit (utils.h:39)
    by 0x52728F2: amr_efr_from_canon (fmt_amr.c:45)
    by 0x5270A7D: osmo_gapk_pq_execute (procqueue.c:202)
    by 0x40296A: run (app_osmo_gapk.c:650)
    by 0x40296A: main (app_osmo_gapk.c:778)
  Uninitialised value was created by a heap allocation
    at 0x4C2AB80: malloc (in vgpreload_memcheck-amd64-linux.so)
    by 0x4E3C2A8: talloc_named_const (in libtalloc.so.2.1.5)
    by 0x5270A1B: osmo_gapk_pq_prepare (procqueue.c:180)
    by 0x402940: run (app_osmo_gapk.c:645)
    by 0x402940: main (app_osmo_gapk.c:778)

Change-Id: I79df56dde23702b0eac8e8fdbc0efd270cc0ace4
Related: OS#2934
---
M src/fmt_ti.c
1 file changed, 2 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/gapk refs/changes/94/9794/1

diff --git a/src/fmt_ti.c b/src/fmt_ti.c
index d7a1ec7..61c0f8c 100644
--- a/src/fmt_ti.c
+++ b/src/fmt_ti.c
@@ -191,7 +191,8 @@
 
 	assert(src_len == TI_LEN);
 
-	dst[30] = 0x00; /* last nibble won't written, pre-clear it */
+	/* Pre-clear the output buffer */
+	memset(dst, 0x00, EFR_CANON_LEN);
 
 	for (i=0; i<244; i++) {
 		int si = i >= 182 ? i+4 : i;

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

Gerrit-Project: gapk
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I79df56dde23702b0eac8e8fdbc0efd270cc0ace4
Gerrit-Change-Number: 9794
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180630/2150db08/attachment.htm>


More information about the gerrit-log mailing list