[Home]

Summary:ASTERISK-27630: [patch] editline: Avoid shifting a negative signed value.
Reporter:Alexander Traud (traud)Labels:patch
Date Opened:2018-01-27 08:46:20.000-0600Date Closed:2018-01-29 10:26:11.000-0600
Priority:MinorRegression?
Status:Closed/CompleteComponents:General
Versions:13.19.0 15.2.0 Frequency of
Occurrence
Related
Issues:
is related toASTERISK-27558 [patch] codec_gsm: Avoid shifting a negative signed value.
is related toASTERISK-27559 [patch] editline: Avoid comparison between pointer and zero character constant.
is related toASTERISK-18725 Several patches related to the internal editline libraries
Environment:Attachments:( 0) libedit_left_shift_unsigned.patch
Description:On FreeBSD 11.1, the default compiler _clang_ (4.0.0) reports:{code}In file included from editline.c:8:
./el.c:173:21: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
                       el->el_flags &= ~HANDLE_SIGNALS;
                                       ~~~~~~~~~~~~~~~
./el.h:58:25: note: expaned from macro 'HANDLE_SIGNALS'
#define HANDLE_SIGNALS  1<<0
                        ^{code}This is an external library, which is still maintained: http://thrysoee.dk/editline/

That upstream project is active, the last change happened just three weeks ago (officially it is called libedit 2.11). The copy within Asterisk is from 2002, libedit 2.6.

The short-term workaround is to use the precompiled libedit of your Unix distribution, for example in Debian/Ubuntu: {{sudo apt install libedit-dev}}. As mid-term solution, I attached/backported the change from September 2003, which resolves the compiler issue above ([original source|http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libedit/el.h.diff?r1=1.14&r2=1.15]).

Although in Asterisk, that library has seen only 49 commits over the last 15 years, as long-term approach, that external library should be
A) updated to the latest upstream version. Or
B) removed and relied solely on precompiled Unix packages, see ASTERISK-18725.
Comments:By: Friendly Automation (friendly-automation) 2018-01-29 10:26:12.190-0600

Change 8068 merged by Jenkins2:
editline: Avoid shifting a negative signed value.

[https://gerrit.asterisk.org/8068|https://gerrit.asterisk.org/8068]

By: Friendly Automation (friendly-automation) 2018-01-29 10:35:41.773-0600

Change 8069 merged by Jenkins2:
editline: Avoid shifting a negative signed value.

[https://gerrit.asterisk.org/8069|https://gerrit.asterisk.org/8069]

By: Friendly Automation (friendly-automation) 2018-01-29 10:46:03.268-0600

Change 8067 merged by Jenkins2:
editline: Avoid shifting a negative signed value.

[https://gerrit.asterisk.org/8067|https://gerrit.asterisk.org/8067]