Bug 38696 - Logic errors: comparison of unsigned expression
Logic errors: comparison of unsigned expression
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: Listener (univention-directory-listener)
UCS 4.0
Other Linux
: P5 normal (vote)
: UCS 4.1-2-errata
Assigned To: Philipp Hahn
Arvid Requate
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2015-06-12 12:41 CEST by Philipp Hahn
Modified: 2016-07-21 15:16 CEST (History)
0 users

See Also:
What kind of report is it?: ---
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Ticket number:
Bug group (optional):
Max CVSS v3 score:
hahn: Patch_Available+


Attachments
Fix comparison of unsigned expression (1.17 KB, text/plain)
2015-06-12 12:41 CEST, Philipp Hahn
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Philipp Hahn univentionstaff 2015-06-12 12:41:19 CEST
Created attachment 6957 [details]
Fix comparison of unsigned expression

# make CC=clang -C src
clang -g -Wall -Werror -D_FILE_OFFSET_BITS=64 -I/usr/include/db3 -DWITH_DB3   -c -o cache_lowlevel.o cache_lowlevel.c
cache_lowlevel.c:270:44: error: comparison of unsigned expression < 0 is always false
      [-Werror,-Wtautological-compare]
                        hex_dump(UV_DEBUG_ERROR, data, pos-1000 < 0 ? 0 : pos-1000, pos-1000 < 0 ? pos : 1000);
                                                       ~~~~~~~~ ^ ~
cache_lowlevel.c:270:73: error: comparison of unsigned expression < 0 is always false
      [-Werror,-Wtautological-compare]
                        hex_dump(UV_DEBUG_ERROR, data, pos-1000 < 0 ? 0 : pos-1000, pos-1000 < 0 ? pos : 1000);
                                                                                    ~~~~~~~~ ^ ~
Comment 1 Philipp Hahn univentionstaff 2015-06-12 12:45:46 CEST
>                        univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "last 100 bytes of previous entry:");
>-                       hex_dump(UV_DEBUG_ERROR, data, pos-1000 < 0 ? 0 : pos-1000, pos-1000 < 0 ? pos : 1000);

Also note: 100 in the message != 1000 in the dump
Comment 2 Philipp Hahn univentionstaff 2016-06-07 18:08:24 CEST
r69895 | Bug #38696 UDL: Fix comparison of signed values

Package: univention-directory-listener
Version: 10.0.0-11.315.201606071717
Branch: ucs_4.1-0
Scope: errata4.1-2

r69910 | Bug #22383,Bug #30227,Bug #30263,Bug #34324,Bug #34507,Bug #34738,Bug #3490,Bug #38696,Bug #39509,Bug #40600,Bug #41261: UDL YAML
 univention-directory-listener.yaml
Comment 3 Arvid Requate univentionstaff 2016-07-13 18:52:38 CEST
Code review: Ok
Advisory: Ok
Comment 4 Janek Walkenhorst univentionstaff 2016-07-21 15:16:06 CEST
<http://errata.software-univention.de/ucs/4.1/215.html>