[asterisk-bugs] [JIRA] (ASTERISK-27558) [patch] codec_gsm: Avoid shifting a negative signed value.

Alexander Traud (JIRA) noreply at issues.asterisk.org
Sat Jan 6 04:52:39 CST 2018


Alexander Traud created ASTERISK-27558:
------------------------------------------

             Summary: [patch] codec_gsm: Avoid shifting a negative signed value.
                 Key: ASTERISK-27558
                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-27558
             Project: Asterisk
          Issue Type: Bug
      Security Level: None
          Components: Codecs/codec_gsm
    Affects Versions: 15.1.5, 13.18.5
            Reporter: Alexander Traud
            Severity: Minor
         Attachments: libgsm_left_shift_unsigned.patch

The compiler _clang_ (5.0.1) reports:{code}src/short_term.c:67:2: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
        STEP(  -2560,  -16,  13107 );
        ^      ~~~~~
src/short_term.c:70:2: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
        STEP(  -1792,   -8,  17476 );
        ^      ~~~~~
src/short_term.c:71:2: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
        STEP(   -341,   -4,  31454 );
        ^       ~~~~
src/short_term.c:72:2: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
        STEP(  -1144,   -4,  29708 );
        ^      ~~~~~
src/short_term.c:60:32: note: expanded from macro 'STEP'
                temp1    = GSM_SUB( temp1, B << 1 );            \
                                           ~ ^{code}This is an external library, which is still maintained by its original author [Jutta Degener|http://twitter.com/juttadegener]: http://www.quut.com/gsm/

The latest upstream change happened in 2017 and that version is called '1.0 Patchlevel 17' aka 1.0.17. The copy within Asterisk is '1.0 Patchlevel 10' aka 1.0.9 from 1996. Debian 9, Ubuntu 18.04 LTS, FreeBSD 11.1, and CentOS 7.4 have 1.0.13 (from 2009). OpenBSD 6.2 has the current version.

Therefore, the *short*-term workaround is to use the precompiled libgsm of your Unix distribution, for example in Debian/Ubuntu: {{sudo apt install libgsm1-dev}}. As *mid*-term solution, I created/attached the difference between 1.0.10 and 1.0.17 for the file {{src/codec.c}}, which resolves the clang issue above. As *long*-term approach within Asterisk, that external library should be
A) updated to the latest upstream version. Or
B) removed and relied solely on precompiled Unix packages.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list