util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/10] pull: AddressSanitizer round II
@ 2014-11-30 13:57 Sami Kerola
  2014-11-30 13:57 ` [PATCH 01/10] lib/mbalign: fix unsigned integer overflow [AddressSanitizer] Sami Kerola
                   ` (12 more replies)
  0 siblings, 13 replies; 34+ messages in thread
From: Sami Kerola @ 2014-11-30 13:57 UTC (permalink / raw)
  To: util-linux; +Cc: Sami Kerola

Hello,

Here comes the second set of changes to enable AddressSanitizer one day
in future.  These changed does not include update to travis-functions, as
demonstrated below, due reason explained later.  The environment changes
in the diff are useful for other who want to try ASAN compilations.

diff --git a/.travis-functions.sh b/.travis-functions.sh
index ed491f4..875b8ad 100755
--- a/.travis-functions.sh
+++ b/.travis-functions.sh
@@ -52,6 +52,12 @@ function check_nonroot
 
 function check_root
 {
+	case $CC in
+	*clang)
+		export CFLAGS="$CFLAGS -O1 -g -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined"
+		export ASAN_SYMBOLIZER_PATH=`which llvm-symbolizer`
+		;;
+	esac
 	configure_travis \
 		--with-python \
 		--enable-all-programs \

The reason why the above is not added to this change set is that travis
has clang-3.4 and reports the following false positive error.

-- snip
==3344==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fffe6e45cf0 at pc 0x4501f9 bp 0x7fffe6e45b50 sp 0x7fffe6e45b28
WRITE of size 112 at 0x7fffe6e45cf0 thread T0
    #0 0x4501f8 in shmctl /home/users/aadgrand/LLVM/releases/ubuntu/final/llvm.src/projects/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc:2502
    #1 0x488642 in do_shm /home/travis/build/kerolasa/lelux-utiliteetit/sys-utils/ipcs.c:214
    #2 0x4844a8 in main /home/travis/build/kerolasa/lelux-utiliteetit/sys-utils/ipcs.c:175
    #3 0x2b186c94976c (/lib/x86_64-linux-gnu/libc.so.6+0x2176c)
    #4 0x48408c in _start (/home/travis/build/kerolasa/lelux-utiliteetit/ipcs+0x48408c)

Address 0x7fffe6e45cf0 is located in stack of thread T0 at offset 272 in frame
    #0 0x48831f in do_shm /home/travis/build/kerolasa/lelux-utiliteetit/sys-utils/ipcs.c:187

  This frame has 3 object(s):
    [32, 40) 'shmds'
    [96, 168) 'lim'
    [224, 272) 'shm_info' <== Memory access at offset 272 overflows this variable
-- snip

The error does not happen with clang-3.5.0, and I have hunch the issue
fix below has something to do with this.

https://code.google.com/p/address-sanitizer/issues/detail?id=259

In my mind it would be best to wait travis clang update before taking the
AddressSanitizer in automatic use.  Else some sort of ipcs temporary
workaround is needed.  But adding a workaround to satisfy static analyzer
feels wrong, so how about fixing the issue by waiting an update that
inevitably will happen sooner or later.

Meanwhile there is still a code issues:

        fdisk: MBR - sort                     ...include/pt-mbr.h:24:51: runtime error: left shift of 233 by 24 places cannot be represented in type 'int'
include/pt-mbr.h:24:51: runtime error: left shift of 233 by 24 places cannot be represented in type 'int'
include/pt-mbr.h:24:51: runtime error: left shift of 233 by 24 places cannot be represented in type 'int'

I don't know how to fix that without '(possibly|likely)' breaking something.

In case someone is curious to see how travis build log looks here is a
sample.  Downloading the file and reading with 'less -r' (imho) improves
reading experience of that file.

https://s3.amazonaws.com/archive.travis-ci.org/jobs/42539750/log.txt


Sami Kerola (10):
  lib/mbalign: fix unsigned integer overflow [AddressSanitizer]
  cal: fix signed integer overflow [AddressSanitizer]
  more: fix unsigned integer overflow [AddressSanitizer]
  lib: fix crc32 and crc64 interger overflows [AddressSanitizer]
  fdisk: (sgi) fix unsigned integer overflow [AddressSanitizer]
  strutils: fix unsigned integer overflows [AddressSanitizer]
  mkfs.cramfs: fix unsigned integer overflow [AddressSanitizer]
  include/c: define UL_ASAN_BLACKLIST address_sanitizer function
    attribute
  lscpu: blacklist vmware_bdoor() AddressSanitizer check
  ipcs: fix two data type errors [AddressSanitizer]

 disk-utils/mkfs.cramfs.c    |   5 +-
 include/c.h                 |  17 +++
 include/pt-sgi.h            |   4 +-
 include/strutils.h          |   9 +-
 lib/crc32.c                 |   4 +-
 lib/crc64.c                 |   3 +-
 lib/mbsalign.c              |   2 +-
 misc-utils/cal.c            |   6 +-
 sys-utils/ipcutils.c        |   4 +-
 sys-utils/lscpu.c           |   2 +-
 tests/expected/cal/bigyear  | 312 +++++++++++++++++++++---------------------
 tests/expected/cal/bigyearw | 324 ++++++++++++++++++++++----------------------
 text-utils/more.c           |   6 +-
 13 files changed, 364 insertions(+), 334 deletions(-)

-- 
2.1.3


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 01/10] lib/mbalign: fix unsigned integer overflow [AddressSanitizer]
  2014-11-30 13:57 [PATCH 00/10] pull: AddressSanitizer round II Sami Kerola
@ 2014-11-30 13:57 ` Sami Kerola
  2014-12-03 23:53   ` Pádraig Brady
  2014-12-04 11:51   ` Pádraig Brady
  2014-11-30 13:57 ` [PATCH 02/10] cal: fix signed " Sami Kerola
                   ` (11 subsequent siblings)
  12 siblings, 2 replies; 34+ messages in thread
From: Sami Kerola @ 2014-11-30 13:57 UTC (permalink / raw)
  To: util-linux; +Cc: Sami Kerola

This error was reported 155 times.

lib/mbsalign.c:322:18: runtime error: unsigned integer overflow: 0 - 1
cannot be represented in type 'size_t' (aka 'unsigned long')

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 lib/mbsalign.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/mbsalign.c b/lib/mbsalign.c
index b307d19..052fec6 100644
--- a/lib/mbsalign.c
+++ b/lib/mbsalign.c
@@ -319,7 +319,7 @@ mbs_align_pad (char *dest, const char* dest_end, size_t n_spaces)
 {
   /* FIXME: Should we pad with "figure space" (\u2007)
      if non ascii data present?  */
-  while (n_spaces-- && (dest < dest_end))
+  for (/* nothing */; n_spaces && (dest < dest_end); n_spaces--)
     *dest++ = ' ';
   *dest = '\0';
   return dest;
-- 
2.1.3


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 02/10] cal: fix signed integer overflow [AddressSanitizer]
  2014-11-30 13:57 [PATCH 00/10] pull: AddressSanitizer round II Sami Kerola
  2014-11-30 13:57 ` [PATCH 01/10] lib/mbalign: fix unsigned integer overflow [AddressSanitizer] Sami Kerola
@ 2014-11-30 13:57 ` Sami Kerola
  2014-12-08 11:07   ` Karel Zak
  2014-11-30 13:57 ` [PATCH 03/10] more: fix unsigned " Sami Kerola
                   ` (10 subsequent siblings)
  12 siblings, 1 reply; 34+ messages in thread
From: Sami Kerola @ 2014-11-30 13:57 UTC (permalink / raw)
  To: util-linux; +Cc: Sami Kerola

misc-utils/cal.c:811:16: runtime error: signed integer overflow:
2147483645 + 536870911 cannot be represented in type 'int'

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 misc-utils/cal.c            |   6 +-
 tests/expected/cal/bigyear  | 312 +++++++++++++++++++++---------------------
 tests/expected/cal/bigyearw | 324 ++++++++++++++++++++++----------------------
 3 files changed, 322 insertions(+), 320 deletions(-)

diff --git a/misc-utils/cal.c b/misc-utils/cal.c
index a11136a..593ab28 100644
--- a/misc-utils/cal.c
+++ b/misc-utils/cal.c
@@ -807,9 +807,11 @@ static int day_in_week(int day, int month, int32_t year)
 		year -= (month < 3) + 14;
 	if (REFORMATION_YEAR < year
 	    || (year == REFORMATION_YEAR && 9 < month)
-	    || (year == REFORMATION_YEAR && month == 9 && 13 < day))
-		return (year + (year / 4) - (year / 100) + (year / 400) + reform[month - 1] +
+	    || (year == REFORMATION_YEAR && month == 9 && 13 < day)) {
+		long long_year = year;
+		return (long_year + (year / 4) - (year / 100) + (year / 400) + reform[month - 1] +
 			day) % 7;
+	}
 	if (year < REFORMATION_YEAR
 	    || (year == REFORMATION_YEAR && month < 9)
 	    || (year == REFORMATION_YEAR && month == 9 && day < 3))
diff --git a/tests/expected/cal/bigyear b/tests/expected/cal/bigyear
index 8dbd276..922a810 100644
--- a/tests/expected/cal/bigyear
+++ b/tests/expected/cal/bigyear
@@ -2,248 +2,248 @@
 Gregorian - Monday-based month
  December 2147483646
 Mo Tu We Th Fr Sa Su
+                1  2 
+ 3  4  5  6  7  8  9 
+10 11 12 13 14 15 16 
+17 18 19 20 21 22 23 
+24 25 26 27 28 29 30 
+31                   
+Gregorian - Sunday-based month
+ December 2147483646
+Su Mo Tu We Th Fr Sa
                    1 
  2  3  4  5  6  7  8 
  9 10 11 12 13 14 15 
 16 17 18 19 20 21 22 
 23 24 25 26 27 28 29 
 30 31                
-Gregorian - Sunday-based month
- December 2147483646
-Su Mo Tu We Th Fr Sa
- 1  2  3  4  5  6  7 
- 8  9 10 11 12 13 14 
-15 16 17 18 19 20 21 
-22 23 24 25 26 27 28 
-29 30 31             
-                     
 Julian - Monday-based month
     December 2147483646    
 Mon Tue Wed Thu Fri Sat Sun
+                    335 336 
+337 338 339 340 341 342 343 
+344 345 346 347 348 349 350 
+351 352 353 354 355 356 357 
+358 359 360 361 362 363 364 
+365                         
+Julian - Sunday-based month
+    December 2147483646    
+Sun Mon Tue Wed Thu Fri Sat
                         335 
 336 337 338 339 340 341 342 
 343 344 345 346 347 348 349 
 350 351 352 353 354 355 356 
 357 358 359 360 361 362 363 
 364 365                     
-Julian - Sunday-based month
-    December 2147483646    
-Sun Mon Tue Wed Thu Fri Sat
-335 336 337 338 339 340 341 
-342 343 344 345 346 347 348 
-349 350 351 352 353 354 355 
-356 357 358 359 360 361 362 
-363 364 365                 
-                            
 Gregorian - Monday-based three months
  November 2147483646   December 2147483646   January 2147483647 
 Mo Tu We Th Fr Sa Su  Mo Tu We Th Fr Sa Su  Mo Tu We Th Fr Sa Su
-                   1                     1                     1 
- 2  3  4  5  6  7  8   2  3  4  5  6  7  8   2  3  4  5  6  7  8 
- 9 10 11 12 13 14 15   9 10 11 12 13 14 15   9 10 11 12 13 14 15 
-16 17 18 19 20 21 22  16 17 18 19 20 21 22  16 17 18 19 20 21 22 
-23 24 25 26 27 28 29  23 24 25 26 27 28 29  23 24 25 26 27 28 29 
-30                    30 31                 30 31                
+          1  2  3  4                  1  2      1  2  3  4  5  6 
+ 5  6  7  8  9 10 11   3  4  5  6  7  8  9   7  8  9 10 11 12 13 
+12 13 14 15 16 17 18  10 11 12 13 14 15 16  14 15 16 17 18 19 20 
+19 20 21 22 23 24 25  17 18 19 20 21 22 23  21 22 23 24 25 26 27 
+26 27 28 29 30        24 25 26 27 28 29 30  28 29 30 31          
+                      31                                         
 Gregorian - Sunday-based three months
  November 2147483646   December 2147483646   January 2147483647 
 Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa
- 1  2  3  4  5  6  7   1  2  3  4  5  6  7   1  2  3  4  5  6  7 
- 8  9 10 11 12 13 14   8  9 10 11 12 13 14   8  9 10 11 12 13 14 
-15 16 17 18 19 20 21  15 16 17 18 19 20 21  15 16 17 18 19 20 21 
-22 23 24 25 26 27 28  22 23 24 25 26 27 28  22 23 24 25 26 27 28 
-29 30                 29 30 31              29 30 31             
-                                                                 
+             1  2  3                     1         1  2  3  4  5 
+ 4  5  6  7  8  9 10   2  3  4  5  6  7  8   6  7  8  9 10 11 12 
+11 12 13 14 15 16 17   9 10 11 12 13 14 15  13 14 15 16 17 18 19 
+18 19 20 21 22 23 24  16 17 18 19 20 21 22  20 21 22 23 24 25 26 
+25 26 27 28 29 30     23 24 25 26 27 28 29  27 28 29 30 31       
+                      30 31                                      
 Julian - Monday-based three months
     November 2147483646          December 2147483646           January 2147483647    
 Mon Tue Wed Thu Fri Sat Sun  Mon Tue Wed Thu Fri Sat Sun  Mon Tue Wed Thu Fri Sat Sun
-                        305                          335                            1 
-306 307 308 309 310 311 312  336 337 338 339 340 341 342    2   3   4   5   6   7   8 
-313 314 315 316 317 318 319  343 344 345 346 347 348 349    9  10  11  12  13  14  15 
-320 321 322 323 324 325 326  350 351 352 353 354 355 356   16  17  18  19  20  21  22 
-327 328 329 330 331 332 333  357 358 359 360 361 362 363   23  24  25  26  27  28  29 
-334                          364 365                       30  31                     
+            305 306 307 308                      335 336        1   2   3   4   5   6 
+309 310 311 312 313 314 315  337 338 339 340 341 342 343    7   8   9  10  11  12  13 
+316 317 318 319 320 321 322  344 345 346 347 348 349 350   14  15  16  17  18  19  20 
+323 324 325 326 327 328 329  351 352 353 354 355 356 357   21  22  23  24  25  26  27 
+330 331 332 333 334          358 359 360 361 362 363 364   28  29  30  31             
+                             365                                                      
 Julian - Sunday-based three months
     November 2147483646          December 2147483646           January 2147483647    
 Sun Mon Tue Wed Thu Fri Sat  Sun Mon Tue Wed Thu Fri Sat  Sun Mon Tue Wed Thu Fri Sat
-305 306 307 308 309 310 311  335 336 337 338 339 340 341    1   2   3   4   5   6   7 
-312 313 314 315 316 317 318  342 343 344 345 346 347 348    8   9  10  11  12  13  14 
-319 320 321 322 323 324 325  349 350 351 352 353 354 355   15  16  17  18  19  20  21 
-326 327 328 329 330 331 332  356 357 358 359 360 361 362   22  23  24  25  26  27  28 
-333 334                      363 364 365                   29  30  31                 
-                                                                                      
+                305 306 307                          335            1   2   3   4   5 
+308 309 310 311 312 313 314  336 337 338 339 340 341 342    6   7   8   9  10  11  12 
+315 316 317 318 319 320 321  343 344 345 346 347 348 349   13  14  15  16  17  18  19 
+322 323 324 325 326 327 328  350 351 352 353 354 355 356   20  21  22  23  24  25  26 
+329 330 331 332 333 334      357 358 359 360 361 362 363   27  28  29  30  31         
+                             364 365                                                  
 Gregorian - Monday-based year
                             2147483646                            
 
        January               February                 March       
 Mo Tu We Th Fr Sa Su   Mo Tu We Th Fr Sa Su   Mo Tu We Th Fr Sa Su
-                   1                      1                      1   
- 2  3  4  5  6  7  8    2  3  4  5  6  7  8    2  3  4  5  6  7  8   
- 9 10 11 12 13 14 15    9 10 11 12 13 14 15    9 10 11 12 13 14 15   
-16 17 18 19 20 21 22   16 17 18 19 20 21 22   16 17 18 19 20 21 22   
-23 24 25 26 27 28 29   23 24 25 26 27 28      23 24 25 26 27 28 29   
-30 31                                         30 31                  
+ 1  2  3  4  5  6  7             1  2  3  4             1  2  3  4   
+ 8  9 10 11 12 13 14    5  6  7  8  9 10 11    5  6  7  8  9 10 11   
+15 16 17 18 19 20 21   12 13 14 15 16 17 18   12 13 14 15 16 17 18   
+22 23 24 25 26 27 28   19 20 21 22 23 24 25   19 20 21 22 23 24 25   
+29 30 31               26 27 28               26 27 28 29 30 31      
+                                                                     
         April                   May                   June        
 Mo Tu We Th Fr Sa Su   Mo Tu We Th Fr Sa Su   Mo Tu We Th Fr Sa Su
-                   1                      1                      1   
- 2  3  4  5  6  7  8    2  3  4  5  6  7  8    2  3  4  5  6  7  8   
- 9 10 11 12 13 14 15    9 10 11 12 13 14 15    9 10 11 12 13 14 15   
-16 17 18 19 20 21 22   16 17 18 19 20 21 22   16 17 18 19 20 21 22   
-23 24 25 26 27 28 29   23 24 25 26 27 28 29   23 24 25 26 27 28 29   
-30                     30 31                  30                     
+                   1       1  2  3  4  5  6                1  2  3   
+ 2  3  4  5  6  7  8    7  8  9 10 11 12 13    4  5  6  7  8  9 10   
+ 9 10 11 12 13 14 15   14 15 16 17 18 19 20   11 12 13 14 15 16 17   
+16 17 18 19 20 21 22   21 22 23 24 25 26 27   18 19 20 21 22 23 24   
+23 24 25 26 27 28 29   28 29 30 31            25 26 27 28 29 30      
+30                                                                   
         July                  August                September     
 Mo Tu We Th Fr Sa Su   Mo Tu We Th Fr Sa Su   Mo Tu We Th Fr Sa Su
-                   1                      1                      1   
- 2  3  4  5  6  7  8    2  3  4  5  6  7  8    2  3  4  5  6  7  8   
- 9 10 11 12 13 14 15    9 10 11 12 13 14 15    9 10 11 12 13 14 15   
-16 17 18 19 20 21 22   16 17 18 19 20 21 22   16 17 18 19 20 21 22   
-23 24 25 26 27 28 29   23 24 25 26 27 28 29   23 24 25 26 27 28 29   
-30 31                  30 31                  30                     
+                   1          1  2  3  4  5                   1  2   
+ 2  3  4  5  6  7  8    6  7  8  9 10 11 12    3  4  5  6  7  8  9   
+ 9 10 11 12 13 14 15   13 14 15 16 17 18 19   10 11 12 13 14 15 16   
+16 17 18 19 20 21 22   20 21 22 23 24 25 26   17 18 19 20 21 22 23   
+23 24 25 26 27 28 29   27 28 29 30 31         24 25 26 27 28 29 30   
+30 31                                                                
        October               November               December      
 Mo Tu We Th Fr Sa Su   Mo Tu We Th Fr Sa Su   Mo Tu We Th Fr Sa Su
-                   1                      1                      1   
- 2  3  4  5  6  7  8    2  3  4  5  6  7  8    2  3  4  5  6  7  8   
- 9 10 11 12 13 14 15    9 10 11 12 13 14 15    9 10 11 12 13 14 15   
-16 17 18 19 20 21 22   16 17 18 19 20 21 22   16 17 18 19 20 21 22   
-23 24 25 26 27 28 29   23 24 25 26 27 28 29   23 24 25 26 27 28 29   
-30 31                  30                     30 31                  
+ 1  2  3  4  5  6  7             1  2  3  4                   1  2   
+ 8  9 10 11 12 13 14    5  6  7  8  9 10 11    3  4  5  6  7  8  9   
+15 16 17 18 19 20 21   12 13 14 15 16 17 18   10 11 12 13 14 15 16   
+22 23 24 25 26 27 28   19 20 21 22 23 24 25   17 18 19 20 21 22 23   
+29 30 31               26 27 28 29 30         24 25 26 27 28 29 30   
+                                              31                     
 
 Gregorian - Sunday-based year
                             2147483646                            
 
        January               February                 March       
 Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa
- 1  2  3  4  5  6  7    1  2  3  4  5  6  7    1  2  3  4  5  6  7   
- 8  9 10 11 12 13 14    8  9 10 11 12 13 14    8  9 10 11 12 13 14   
-15 16 17 18 19 20 21   15 16 17 18 19 20 21   15 16 17 18 19 20 21   
-22 23 24 25 26 27 28   22 23 24 25 26 27 28   22 23 24 25 26 27 28   
-29 30 31                                      29 30 31               
+    1  2  3  4  5  6                1  2  3                1  2  3   
+ 7  8  9 10 11 12 13    4  5  6  7  8  9 10    4  5  6  7  8  9 10   
+14 15 16 17 18 19 20   11 12 13 14 15 16 17   11 12 13 14 15 16 17   
+21 22 23 24 25 26 27   18 19 20 21 22 23 24   18 19 20 21 22 23 24   
+28 29 30 31            25 26 27 28            25 26 27 28 29 30 31   
                                                                      
         April                   May                   June        
 Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa
- 1  2  3  4  5  6  7    1  2  3  4  5  6  7    1  2  3  4  5  6  7   
- 8  9 10 11 12 13 14    8  9 10 11 12 13 14    8  9 10 11 12 13 14   
-15 16 17 18 19 20 21   15 16 17 18 19 20 21   15 16 17 18 19 20 21   
-22 23 24 25 26 27 28   22 23 24 25 26 27 28   22 23 24 25 26 27 28   
-29 30                  29 30 31               29 30                  
+ 1  2  3  4  5  6  7          1  2  3  4  5                   1  2   
+ 8  9 10 11 12 13 14    6  7  8  9 10 11 12    3  4  5  6  7  8  9   
+15 16 17 18 19 20 21   13 14 15 16 17 18 19   10 11 12 13 14 15 16   
+22 23 24 25 26 27 28   20 21 22 23 24 25 26   17 18 19 20 21 22 23   
+29 30                  27 28 29 30 31         24 25 26 27 28 29 30   
                                                                      
         July                  August                September     
 Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa
- 1  2  3  4  5  6  7    1  2  3  4  5  6  7    1  2  3  4  5  6  7   
- 8  9 10 11 12 13 14    8  9 10 11 12 13 14    8  9 10 11 12 13 14   
-15 16 17 18 19 20 21   15 16 17 18 19 20 21   15 16 17 18 19 20 21   
-22 23 24 25 26 27 28   22 23 24 25 26 27 28   22 23 24 25 26 27 28   
-29 30 31               29 30 31               29 30                  
-                                                                     
+ 1  2  3  4  5  6  7             1  2  3  4                      1   
+ 8  9 10 11 12 13 14    5  6  7  8  9 10 11    2  3  4  5  6  7  8   
+15 16 17 18 19 20 21   12 13 14 15 16 17 18    9 10 11 12 13 14 15   
+22 23 24 25 26 27 28   19 20 21 22 23 24 25   16 17 18 19 20 21 22   
+29 30 31               26 27 28 29 30 31      23 24 25 26 27 28 29   
+                                              30                     
        October               November               December      
 Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa
- 1  2  3  4  5  6  7    1  2  3  4  5  6  7    1  2  3  4  5  6  7   
- 8  9 10 11 12 13 14    8  9 10 11 12 13 14    8  9 10 11 12 13 14   
-15 16 17 18 19 20 21   15 16 17 18 19 20 21   15 16 17 18 19 20 21   
-22 23 24 25 26 27 28   22 23 24 25 26 27 28   22 23 24 25 26 27 28   
-29 30 31               29 30                  29 30 31               
-                                                                     
+    1  2  3  4  5  6                1  2  3                      1   
+ 7  8  9 10 11 12 13    4  5  6  7  8  9 10    2  3  4  5  6  7  8   
+14 15 16 17 18 19 20   11 12 13 14 15 16 17    9 10 11 12 13 14 15   
+21 22 23 24 25 26 27   18 19 20 21 22 23 24   16 17 18 19 20 21 22   
+28 29 30 31            25 26 27 28 29 30      23 24 25 26 27 28 29   
+                                              30 31                  
 
 Julian - Monday-based year
                         2147483646                       
 
           January                       February         
 Mon Tue Wed Thu Fri Sat Sun   Mon Tue Wed Thu Fri Sat Sun
-                          1                            32   
-  2   3   4   5   6   7   8    33  34  35  36  37  38  39   
-  9  10  11  12  13  14  15    40  41  42  43  44  45  46   
- 16  17  18  19  20  21  22    47  48  49  50  51  52  53   
- 23  24  25  26  27  28  29    54  55  56  57  58  59       
- 30  31                                                     
+  1   2   3   4   5   6   7                32  33  34  35   
+  8   9  10  11  12  13  14    36  37  38  39  40  41  42   
+ 15  16  17  18  19  20  21    43  44  45  46  47  48  49   
+ 22  23  24  25  26  27  28    50  51  52  53  54  55  56   
+ 29  30  31                    57  58  59                   
+                                                            
            March                         April           
 Mon Tue Wed Thu Fri Sat Sun   Mon Tue Wed Thu Fri Sat Sun
-                         60                            91   
- 61  62  63  64  65  66  67    92  93  94  95  96  97  98   
- 68  69  70  71  72  73  74    99 100 101 102 103 104 105   
- 75  76  77  78  79  80  81   106 107 108 109 110 111 112   
- 82  83  84  85  86  87  88   113 114 115 116 117 118 119   
- 89  90                       120                           
+             60  61  62  63                            91   
+ 64  65  66  67  68  69  70    92  93  94  95  96  97  98   
+ 71  72  73  74  75  76  77    99 100 101 102 103 104 105   
+ 78  79  80  81  82  83  84   106 107 108 109 110 111 112   
+ 85  86  87  88  89  90       113 114 115 116 117 118 119   
+                              120                           
             May                           June           
 Mon Tue Wed Thu Fri Sat Sun   Mon Tue Wed Thu Fri Sat Sun
-                        121                           152   
-122 123 124 125 126 127 128   153 154 155 156 157 158 159   
-129 130 131 132 133 134 135   160 161 162 163 164 165 166   
-136 137 138 139 140 141 142   167 168 169 170 171 172 173   
-143 144 145 146 147 148 149   174 175 176 177 178 179 180   
-150 151                       181                           
+    121 122 123 124 125 126                   152 153 154   
+127 128 129 130 131 132 133   155 156 157 158 159 160 161   
+134 135 136 137 138 139 140   162 163 164 165 166 167 168   
+141 142 143 144 145 146 147   169 170 171 172 173 174 175   
+148 149 150 151               176 177 178 179 180 181       
+                                                            
             July                         August          
 Mon Tue Wed Thu Fri Sat Sun   Mon Tue Wed Thu Fri Sat Sun
-                        182                           213   
-183 184 185 186 187 188 189   214 215 216 217 218 219 220   
-190 191 192 193 194 195 196   221 222 223 224 225 226 227   
-197 198 199 200 201 202 203   228 229 230 231 232 233 234   
-204 205 206 207 208 209 210   235 236 237 238 239 240 241   
-211 212                       242 243                       
+                        182           213 214 215 216 217   
+183 184 185 186 187 188 189   218 219 220 221 222 223 224   
+190 191 192 193 194 195 196   225 226 227 228 229 230 231   
+197 198 199 200 201 202 203   232 233 234 235 236 237 238   
+204 205 206 207 208 209 210   239 240 241 242 243           
+211 212                                                     
          September                      October          
 Mon Tue Wed Thu Fri Sat Sun   Mon Tue Wed Thu Fri Sat Sun
-                        244                           274   
-245 246 247 248 249 250 251   275 276 277 278 279 280 281   
-252 253 254 255 256 257 258   282 283 284 285 286 287 288   
-259 260 261 262 263 264 265   289 290 291 292 293 294 295   
-266 267 268 269 270 271 272   296 297 298 299 300 301 302   
-273                           303 304                       
+                    244 245   274 275 276 277 278 279 280   
+246 247 248 249 250 251 252   281 282 283 284 285 286 287   
+253 254 255 256 257 258 259   288 289 290 291 292 293 294   
+260 261 262 263 264 265 266   295 296 297 298 299 300 301   
+267 268 269 270 271 272 273   302 303 304                   
+                                                            
           November                      December         
 Mon Tue Wed Thu Fri Sat Sun   Mon Tue Wed Thu Fri Sat Sun
-                        305                           335   
-306 307 308 309 310 311 312   336 337 338 339 340 341 342   
-313 314 315 316 317 318 319   343 344 345 346 347 348 349   
-320 321 322 323 324 325 326   350 351 352 353 354 355 356   
-327 328 329 330 331 332 333   357 358 359 360 361 362 363   
-334                           364 365                       
+            305 306 307 308                       335 336   
+309 310 311 312 313 314 315   337 338 339 340 341 342 343   
+316 317 318 319 320 321 322   344 345 346 347 348 349 350   
+323 324 325 326 327 328 329   351 352 353 354 355 356 357   
+330 331 332 333 334           358 359 360 361 362 363 364   
+                              365                           
 
 Julian - Sunday-based year
                         2147483646                       
 
           January                       February         
 Sun Mon Tue Wed Thu Fri Sat   Sun Mon Tue Wed Thu Fri Sat
-  1   2   3   4   5   6   7    32  33  34  35  36  37  38   
-  8   9  10  11  12  13  14    39  40  41  42  43  44  45   
- 15  16  17  18  19  20  21    46  47  48  49  50  51  52   
- 22  23  24  25  26  27  28    53  54  55  56  57  58  59   
- 29  30  31                                                 
+      1   2   3   4   5   6                    32  33  34   
+  7   8   9  10  11  12  13    35  36  37  38  39  40  41   
+ 14  15  16  17  18  19  20    42  43  44  45  46  47  48   
+ 21  22  23  24  25  26  27    49  50  51  52  53  54  55   
+ 28  29  30  31                56  57  58  59               
                                                             
            March                         April           
 Sun Mon Tue Wed Thu Fri Sat   Sun Mon Tue Wed Thu Fri Sat
- 60  61  62  63  64  65  66    91  92  93  94  95  96  97   
- 67  68  69  70  71  72  73    98  99 100 101 102 103 104   
- 74  75  76  77  78  79  80   105 106 107 108 109 110 111   
- 81  82  83  84  85  86  87   112 113 114 115 116 117 118   
- 88  89  90                   119 120                       
+                 60  61  62    91  92  93  94  95  96  97   
+ 63  64  65  66  67  68  69    98  99 100 101 102 103 104   
+ 70  71  72  73  74  75  76   105 106 107 108 109 110 111   
+ 77  78  79  80  81  82  83   112 113 114 115 116 117 118   
+ 84  85  86  87  88  89  90   119 120                       
                                                             
             May                           June           
 Sun Mon Tue Wed Thu Fri Sat   Sun Mon Tue Wed Thu Fri Sat
-121 122 123 124 125 126 127   152 153 154 155 156 157 158   
-128 129 130 131 132 133 134   159 160 161 162 163 164 165   
-135 136 137 138 139 140 141   166 167 168 169 170 171 172   
-142 143 144 145 146 147 148   173 174 175 176 177 178 179   
-149 150 151                   180 181                       
+        121 122 123 124 125                       152 153   
+126 127 128 129 130 131 132   154 155 156 157 158 159 160   
+133 134 135 136 137 138 139   161 162 163 164 165 166 167   
+140 141 142 143 144 145 146   168 169 170 171 172 173 174   
+147 148 149 150 151           175 176 177 178 179 180 181   
                                                             
             July                         August          
 Sun Mon Tue Wed Thu Fri Sat   Sun Mon Tue Wed Thu Fri Sat
-182 183 184 185 186 187 188   213 214 215 216 217 218 219   
-189 190 191 192 193 194 195   220 221 222 223 224 225 226   
-196 197 198 199 200 201 202   227 228 229 230 231 232 233   
-203 204 205 206 207 208 209   234 235 236 237 238 239 240   
-210 211 212                   241 242 243                   
+182 183 184 185 186 187 188               213 214 215 216   
+189 190 191 192 193 194 195   217 218 219 220 221 222 223   
+196 197 198 199 200 201 202   224 225 226 227 228 229 230   
+203 204 205 206 207 208 209   231 232 233 234 235 236 237   
+210 211 212                   238 239 240 241 242 243       
                                                             
          September                      October          
 Sun Mon Tue Wed Thu Fri Sat   Sun Mon Tue Wed Thu Fri Sat
-244 245 246 247 248 249 250   274 275 276 277 278 279 280   
-251 252 253 254 255 256 257   281 282 283 284 285 286 287   
-258 259 260 261 262 263 264   288 289 290 291 292 293 294   
-265 266 267 268 269 270 271   295 296 297 298 299 300 301   
-272 273                       302 303 304                   
-                                                            
+                        244       274 275 276 277 278 279   
+245 246 247 248 249 250 251   280 281 282 283 284 285 286   
+252 253 254 255 256 257 258   287 288 289 290 291 292 293   
+259 260 261 262 263 264 265   294 295 296 297 298 299 300   
+266 267 268 269 270 271 272   301 302 303 304               
+273                                                         
           November                      December         
 Sun Mon Tue Wed Thu Fri Sat   Sun Mon Tue Wed Thu Fri Sat
-305 306 307 308 309 310 311   335 336 337 338 339 340 341   
-312 313 314 315 316 317 318   342 343 344 345 346 347 348   
-319 320 321 322 323 324 325   349 350 351 352 353 354 355   
-326 327 328 329 330 331 332   356 357 358 359 360 361 362   
-333 334                       363 364 365                   
-                                                            
+                305 306 307                           335   
+308 309 310 311 312 313 314   336 337 338 339 340 341 342   
+315 316 317 318 319 320 321   343 344 345 346 347 348 349   
+322 323 324 325 326 327 328   350 351 352 353 354 355 356   
+329 330 331 332 333 334       357 358 359 360 361 362 363   
+                              364 365                       
 
diff --git a/tests/expected/cal/bigyearw b/tests/expected/cal/bigyearw
index b2ce206..fae271e 100644
--- a/tests/expected/cal/bigyearw
+++ b/tests/expected/cal/bigyearw
@@ -2,248 +2,248 @@
 Gregorian - Monday-based month with week numbers
   December 2147483646  
    Mo Tu We Th Fr Sa Su
-48                    1 
-49  2  3  4  5  6  7  8 
-50  9 10 11 12 13 14 15 
-51 16 17 18 19 20 21 22 
-52 23 24 25 26 27 28 29 
-52 30 31                
+48                 1  2 
+49  3  4  5  6  7  8  9 
+50 10 11 12 13 14 15 16 
+51 17 18 19 20 21 22 23 
+52 24 25 26 27 28 29 30 
+ 1 31                   
 Gregorian - Sunday-based month with week numbers
   December 2147483646  
    Su Mo Tu We Th Fr Sa
-47  1  2  3  4  5  6  7 
-48  8  9 10 11 12 13 14 
-49 15 16 17 18 19 20 21 
-50 22 23 24 25 26 27 28 
-51 29 30 31             
-                        
+47                    1 
+48  2  3  4  5  6  7  8 
+49  9 10 11 12 13 14 15 
+50 16 17 18 19 20 21 22 
+51 23 24 25 26 27 28 29 
+52 30 31                
 Julian - Monday-based month with week numbers
       December 2147483646     
    Mon Tue Wed Thu Fri Sat Sun
-48                         335 
-49 336 337 338 339 340 341 342 
-50 343 344 345 346 347 348 349 
-51 350 351 352 353 354 355 356 
-52 357 358 359 360 361 362 363 
-52 364 365                     
+48                     335 336 
+49 337 338 339 340 341 342 343 
+50 344 345 346 347 348 349 350 
+51 351 352 353 354 355 356 357 
+52 358 359 360 361 362 363 364 
+ 1 365                         
 Julian - Sunday-based month with week numbers
       December 2147483646     
    Sun Mon Tue Wed Thu Fri Sat
-47 335 336 337 338 339 340 341 
-48 342 343 344 345 346 347 348 
-49 349 350 351 352 353 354 355 
-50 356 357 358 359 360 361 362 
-51 363 364 365                 
-                               
+47                         335 
+48 336 337 338 339 340 341 342 
+49 343 344 345 346 347 348 349 
+50 350 351 352 353 354 355 356 
+51 357 358 359 360 361 362 363 
+52 364 365                     
 Gregorian - Monday-based three months with week numbers
   November 2147483646      December 2147483646       January 2147483647  
    Mo Tu We Th Fr Sa Su     Mo Tu We Th Fr Sa Su     Mo Tu We Th Fr Sa Su
-43                    1  48                    1  52                    1 
-44  2  3  4  5  6  7  8  49  2  3  4  5  6  7  8  52  2  3  4  5  6  7  8 
-45  9 10 11 12 13 14 15  50  9 10 11 12 13 14 15  52  9 10 11 12 13 14 15 
-46 16 17 18 19 20 21 22  51 16 17 18 19 20 21 22  52 16 17 18 19 20 21 22 
-47 23 24 25 26 27 28 29  52 23 24 25 26 27 28 29  52 23 24 25 26 27 28 29 
-48 30                    52 30 31                 52 30 31                
+44           1  2  3  4  48                 1  2   1     1  2  3  4  5  6 
+45  5  6  7  8  9 10 11  49  3  4  5  6  7  8  9   2  7  8  9 10 11 12 13 
+46 12 13 14 15 16 17 18  50 10 11 12 13 14 15 16   3 14 15 16 17 18 19 20 
+47 19 20 21 22 23 24 25  51 17 18 19 20 21 22 23   4 21 22 23 24 25 26 27 
+48 26 27 28 29 30        52 24 25 26 27 28 29 30   5 28 29 30 31          
+                          1 31                                            
 Gregorian - Sunday-based three months with week numbers
   November 2147483646      December 2147483646       January 2147483647  
    Su Mo Tu We Th Fr Sa     Su Mo Tu We Th Fr Sa     Su Mo Tu We Th Fr Sa
-43  1  2  3  4  5  6  7  47  1  2  3  4  5  6  7  51  1  2  3  4  5  6  7 
-44  8  9 10 11 12 13 14  48  8  9 10 11 12 13 14  52  8  9 10 11 12 13 14 
-45 15 16 17 18 19 20 21  49 15 16 17 18 19 20 21  51 15 16 17 18 19 20 21 
-46 22 23 24 25 26 27 28  50 22 23 24 25 26 27 28  52 22 23 24 25 26 27 28 
-47 29 30                 51 29 30 31              51 29 30 31             
-                                                                          
+43              1  2  3  47                    1  52        1  2  3  4  5 
+44  4  5  6  7  8  9 10  48  2  3  4  5  6  7  8   1  6  7  8  9 10 11 12 
+45 11 12 13 14 15 16 17  49  9 10 11 12 13 14 15   2 13 14 15 16 17 18 19 
+46 18 19 20 21 22 23 24  50 16 17 18 19 20 21 22   3 20 21 22 23 24 25 26 
+47 25 26 27 28 29 30     51 23 24 25 26 27 28 29   4 27 28 29 30 31       
+                         52 30 31                                         
 Julian - Monday-based three months with week numbers
       November 2147483646             December 2147483646             January 2147483647      
    Mon Tue Wed Thu Fri Sat Sun     Mon Tue Wed Thu Fri Sat Sun     Mon Tue Wed Thu Fri Sat Sun
-43                         305  48                         335  52                           1 
-44 306 307 308 309 310 311 312  49 336 337 338 339 340 341 342  52   2   3   4   5   6   7   8 
-45 313 314 315 316 317 318 319  50 343 344 345 346 347 348 349  52   9  10  11  12  13  14  15 
-46 320 321 322 323 324 325 326  51 350 351 352 353 354 355 356  52  16  17  18  19  20  21  22 
-47 327 328 329 330 331 332 333  52 357 358 359 360 361 362 363  52  23  24  25  26  27  28  29 
-48 334                          52 364 365                      52  30  31                     
+44             305 306 307 308  48                     335 336   1       1   2   3   4   5   6 
+45 309 310 311 312 313 314 315  49 337 338 339 340 341 342 343   2   7   8   9  10  11  12  13 
+46 316 317 318 319 320 321 322  50 344 345 346 347 348 349 350   3  14  15  16  17  18  19  20 
+47 323 324 325 326 327 328 329  51 351 352 353 354 355 356 357   4  21  22  23  24  25  26  27 
+48 330 331 332 333 334          52 358 359 360 361 362 363 364   5  28  29  30  31             
+                                 1 365                                                         
 Julian - Sunday-based three months with week numbers
       November 2147483646             December 2147483646             January 2147483647      
    Sun Mon Tue Wed Thu Fri Sat     Sun Mon Tue Wed Thu Fri Sat     Sun Mon Tue Wed Thu Fri Sat
-43 305 306 307 308 309 310 311  47 335 336 337 338 339 340 341  51   1   2   3   4   5   6   7 
-44 312 313 314 315 316 317 318  48 342 343 344 345 346 347 348  52   8   9  10  11  12  13  14 
-45 319 320 321 322 323 324 325  49 349 350 351 352 353 354 355  51  15  16  17  18  19  20  21 
-46 326 327 328 329 330 331 332  50 356 357 358 359 360 361 362  52  22  23  24  25  26  27  28 
-47 333 334                      51 363 364 365                  51  29  30  31                 
-                                                                                               
+43                 305 306 307  47                         335  52           1   2   3   4   5 
+44 308 309 310 311 312 313 314  48 336 337 338 339 340 341 342   1   6   7   8   9  10  11  12 
+45 315 316 317 318 319 320 321  49 343 344 345 346 347 348 349   2  13  14  15  16  17  18  19 
+46 322 323 324 325 326 327 328  50 350 351 352 353 354 355 356   3  20  21  22  23  24  25  26 
+47 329 330 331 332 333 334      51 357 358 359 360 361 362 363   4  27  28  29  30  31         
+                                52 364 365                                                     
 Gregorian - Monday-based year with week numbers
                                  2147483646                                
 
         January                   February                   March         
    Mo Tu We Th Fr Sa Su      Mo Tu We Th Fr Sa Su      Mo Tu We Th Fr Sa Su
-52                    1    4                    1    8                    1   
-52  2  3  4  5  6  7  8    5  2  3  4  5  6  7  8    9  2  3  4  5  6  7  8   
-52  9 10 11 12 13 14 15    6  9 10 11 12 13 14 15   10  9 10 11 12 13 14 15   
-52 16 17 18 19 20 21 22    7 16 17 18 19 20 21 22   11 16 17 18 19 20 21 22   
-52 23 24 25 26 27 28 29    8 23 24 25 26 27 28      12 23 24 25 26 27 28 29   
-52 30 31                                            13 30 31                  
+ 1  1  2  3  4  5  6  7    5           1  2  3  4    9           1  2  3  4   
+ 2  8  9 10 11 12 13 14    6  5  6  7  8  9 10 11   10  5  6  7  8  9 10 11   
+ 3 15 16 17 18 19 20 21    7 12 13 14 15 16 17 18   11 12 13 14 15 16 17 18   
+ 4 22 23 24 25 26 27 28    8 19 20 21 22 23 24 25   12 19 20 21 22 23 24 25   
+ 5 29 30 31                9 26 27 28               13 26 27 28 29 30 31      
+                                                                              
          April                      May                       June         
    Mo Tu We Th Fr Sa Su      Mo Tu We Th Fr Sa Su      Mo Tu We Th Fr Sa Su
-13                    1   17                    1   22                    1   
-14  2  3  4  5  6  7  8   18  2  3  4  5  6  7  8   23  2  3  4  5  6  7  8   
-15  9 10 11 12 13 14 15   19  9 10 11 12 13 14 15   24  9 10 11 12 13 14 15   
-16 16 17 18 19 20 21 22   20 16 17 18 19 20 21 22   25 16 17 18 19 20 21 22   
-17 23 24 25 26 27 28 29   21 23 24 25 26 27 28 29   26 23 24 25 26 27 28 29   
-18 30                     22 30 31                  27 30                     
+13                    1   18     1  2  3  4  5  6   22              1  2  3   
+14  2  3  4  5  6  7  8   19  7  8  9 10 11 12 13   23  4  5  6  7  8  9 10   
+15  9 10 11 12 13 14 15   20 14 15 16 17 18 19 20   24 11 12 13 14 15 16 17   
+16 16 17 18 19 20 21 22   21 21 22 23 24 25 26 27   25 18 19 20 21 22 23 24   
+17 23 24 25 26 27 28 29   22 28 29 30 31            26 25 26 27 28 29 30      
+18 30                                                                         
           July                     August                  September       
    Mo Tu We Th Fr Sa Su      Mo Tu We Th Fr Sa Su      Mo Tu We Th Fr Sa Su
-26                    1   30                    1   35                    1   
-27  2  3  4  5  6  7  8   31  2  3  4  5  6  7  8   36  2  3  4  5  6  7  8   
-28  9 10 11 12 13 14 15   32  9 10 11 12 13 14 15   37  9 10 11 12 13 14 15   
-29 16 17 18 19 20 21 22   33 16 17 18 19 20 21 22   38 16 17 18 19 20 21 22   
-30 23 24 25 26 27 28 29   34 23 24 25 26 27 28 29   39 23 24 25 26 27 28 29   
-31 30 31                  35 30 31                  40 30                     
+26                    1   31        1  2  3  4  5   35                 1  2   
+27  2  3  4  5  6  7  8   32  6  7  8  9 10 11 12   36  3  4  5  6  7  8  9   
+28  9 10 11 12 13 14 15   33 13 14 15 16 17 18 19   37 10 11 12 13 14 15 16   
+29 16 17 18 19 20 21 22   34 20 21 22 23 24 25 26   38 17 18 19 20 21 22 23   
+30 23 24 25 26 27 28 29   35 27 28 29 30 31         39 24 25 26 27 28 29 30   
+31 30 31                                                                      
         October                   November                  December       
    Mo Tu We Th Fr Sa Su      Mo Tu We Th Fr Sa Su      Mo Tu We Th Fr Sa Su
-39                    1   43                    1   48                    1   
-40  2  3  4  5  6  7  8   44  2  3  4  5  6  7  8   49  2  3  4  5  6  7  8   
-41  9 10 11 12 13 14 15   45  9 10 11 12 13 14 15   50  9 10 11 12 13 14 15   
-42 16 17 18 19 20 21 22   46 16 17 18 19 20 21 22   51 16 17 18 19 20 21 22   
-43 23 24 25 26 27 28 29   47 23 24 25 26 27 28 29   52 23 24 25 26 27 28 29   
-44 30 31                  48 30                     52 30 31                  
+40  1  2  3  4  5  6  7   44           1  2  3  4   48                 1  2   
+41  8  9 10 11 12 13 14   45  5  6  7  8  9 10 11   49  3  4  5  6  7  8  9   
+42 15 16 17 18 19 20 21   46 12 13 14 15 16 17 18   50 10 11 12 13 14 15 16   
+43 22 23 24 25 26 27 28   47 19 20 21 22 23 24 25   51 17 18 19 20 21 22 23   
+44 29 30 31               48 26 27 28 29 30         52 24 25 26 27 28 29 30   
+                                                     1 31                     
 
 Gregorian - Sunday-based year with week numbers
                                  2147483646                                
 
         January                   February                   March         
    Su Mo Tu We Th Fr Sa      Su Mo Tu We Th Fr Sa      Su Mo Tu We Th Fr Sa
-51  1  2  3  4  5  6  7    4  1  2  3  4  5  6  7    8  1  2  3  4  5  6  7   
-52  8  9 10 11 12 13 14    5  8  9 10 11 12 13 14    9  8  9 10 11 12 13 14   
-51 15 16 17 18 19 20 21    6 15 16 17 18 19 20 21   10 15 16 17 18 19 20 21   
-52 22 23 24 25 26 27 28    7 22 23 24 25 26 27 28   11 22 23 24 25 26 27 28   
-51 29 30 31                                         12 29 30 31               
+53     1  2  3  4  5  6    4              1  2  3    8              1  2  3   
+ 1  7  8  9 10 11 12 13    5  4  5  6  7  8  9 10    9  4  5  6  7  8  9 10   
+ 2 14 15 16 17 18 19 20    6 11 12 13 14 15 16 17   10 11 12 13 14 15 16 17   
+ 3 21 22 23 24 25 26 27    7 18 19 20 21 22 23 24   11 18 19 20 21 22 23 24   
+ 4 28 29 30 31             8 25 26 27 28            12 25 26 27 28 29 30 31   
                                                                               
          April                      May                       June         
    Su Mo Tu We Th Fr Sa      Su Mo Tu We Th Fr Sa      Su Mo Tu We Th Fr Sa
-12  1  2  3  4  5  6  7   16  1  2  3  4  5  6  7   21  1  2  3  4  5  6  7   
-13  8  9 10 11 12 13 14   17  8  9 10 11 12 13 14   22  8  9 10 11 12 13 14   
-14 15 16 17 18 19 20 21   18 15 16 17 18 19 20 21   23 15 16 17 18 19 20 21   
-15 22 23 24 25 26 27 28   19 22 23 24 25 26 27 28   24 22 23 24 25 26 27 28   
-16 29 30                  20 29 30 31               25 29 30                  
+13  1  2  3  4  5  6  7   17        1  2  3  4  5   21                 1  2   
+14  8  9 10 11 12 13 14   18  6  7  8  9 10 11 12   22  3  4  5  6  7  8  9   
+15 15 16 17 18 19 20 21   19 13 14 15 16 17 18 19   23 10 11 12 13 14 15 16   
+16 22 23 24 25 26 27 28   20 20 21 22 23 24 25 26   24 17 18 19 20 21 22 23   
+17 29 30                  21 27 28 29 30 31         25 24 25 26 27 28 29 30   
                                                                               
           July                     August                  September       
    Su Mo Tu We Th Fr Sa      Su Mo Tu We Th Fr Sa      Su Mo Tu We Th Fr Sa
-25  1  2  3  4  5  6  7   29  1  2  3  4  5  6  7   34  1  2  3  4  5  6  7   
-26  8  9 10 11 12 13 14   30  8  9 10 11 12 13 14   35  8  9 10 11 12 13 14   
-27 15 16 17 18 19 20 21   31 15 16 17 18 19 20 21   36 15 16 17 18 19 20 21   
-28 22 23 24 25 26 27 28   32 22 23 24 25 26 27 28   37 22 23 24 25 26 27 28   
-29 29 30 31               33 29 30 31               38 29 30                  
-                                                                              
+26  1  2  3  4  5  6  7   30           1  2  3  4   34                    1   
+27  8  9 10 11 12 13 14   31  5  6  7  8  9 10 11   35  2  3  4  5  6  7  8   
+28 15 16 17 18 19 20 21   32 12 13 14 15 16 17 18   36  9 10 11 12 13 14 15   
+29 22 23 24 25 26 27 28   33 19 20 21 22 23 24 25   37 16 17 18 19 20 21 22   
+30 29 30 31               34 26 27 28 29 30 31      38 23 24 25 26 27 28 29   
+                                                    39 30                     
         October                   November                  December       
    Su Mo Tu We Th Fr Sa      Su Mo Tu We Th Fr Sa      Su Mo Tu We Th Fr Sa
-38  1  2  3  4  5  6  7   43  1  2  3  4  5  6  7   47  1  2  3  4  5  6  7   
-39  8  9 10 11 12 13 14   44  8  9 10 11 12 13 14   48  8  9 10 11 12 13 14   
-40 15 16 17 18 19 20 21   45 15 16 17 18 19 20 21   49 15 16 17 18 19 20 21   
-41 22 23 24 25 26 27 28   46 22 23 24 25 26 27 28   50 22 23 24 25 26 27 28   
-42 29 30 31               47 29 30                  51 29 30 31               
-                                                                              
+39     1  2  3  4  5  6   43              1  2  3   47                    1   
+40  7  8  9 10 11 12 13   44  4  5  6  7  8  9 10   48  2  3  4  5  6  7  8   
+41 14 15 16 17 18 19 20   45 11 12 13 14 15 16 17   49  9 10 11 12 13 14 15   
+42 21 22 23 24 25 26 27   46 18 19 20 21 22 23 24   50 16 17 18 19 20 21 22   
+43 28 29 30 31            47 25 26 27 28 29 30      51 23 24 25 26 27 28 29   
+                                                    52 30 31                  
 
 Julian - Monday-based year with week numbers
                            2147483646                          
 
             January                         February           
    Mon Tue Wed Thu Fri Sat Sun      Mon Tue Wed Thu Fri Sat Sun
-52                           1    4                          32   
-52   2   3   4   5   6   7   8    5  33  34  35  36  37  38  39   
-52   9  10  11  12  13  14  15    6  40  41  42  43  44  45  46   
-52  16  17  18  19  20  21  22    7  47  48  49  50  51  52  53   
-52  23  24  25  26  27  28  29    8  54  55  56  57  58  59       
-52  30  31                                                        
+ 1   1   2   3   4   5   6   7    5              32  33  34  35   
+ 2   8   9  10  11  12  13  14    6  36  37  38  39  40  41  42   
+ 3  15  16  17  18  19  20  21    7  43  44  45  46  47  48  49   
+ 4  22  23  24  25  26  27  28    8  50  51  52  53  54  55  56   
+ 5  29  30  31                    9  57  58  59                   
+                                                                  
              March                            April            
    Mon Tue Wed Thu Fri Sat Sun      Mon Tue Wed Thu Fri Sat Sun
- 8                          60   13                          91   
- 9  61  62  63  64  65  66  67   14  92  93  94  95  96  97  98   
-10  68  69  70  71  72  73  74   15  99 100 101 102 103 104 105   
-11  75  76  77  78  79  80  81   16 106 107 108 109 110 111 112   
-12  82  83  84  85  86  87  88   17 113 114 115 116 117 118 119   
-13  89  90                       18 120                           
+ 9              60  61  62  63   13                          91   
+10  64  65  66  67  68  69  70   14  92  93  94  95  96  97  98   
+11  71  72  73  74  75  76  77   15  99 100 101 102 103 104 105   
+12  78  79  80  81  82  83  84   16 106 107 108 109 110 111 112   
+13  85  86  87  88  89  90       17 113 114 115 116 117 118 119   
+                                 18 120                           
               May                             June             
    Mon Tue Wed Thu Fri Sat Sun      Mon Tue Wed Thu Fri Sat Sun
-17                         121   22                         152   
-18 122 123 124 125 126 127 128   23 153 154 155 156 157 158 159   
-19 129 130 131 132 133 134 135   24 160 161 162 163 164 165 166   
-20 136 137 138 139 140 141 142   25 167 168 169 170 171 172 173   
-21 143 144 145 146 147 148 149   26 174 175 176 177 178 179 180   
-22 150 151                       27 181                           
+18     121 122 123 124 125 126   22                 152 153 154   
+19 127 128 129 130 131 132 133   23 155 156 157 158 159 160 161   
+20 134 135 136 137 138 139 140   24 162 163 164 165 166 167 168   
+21 141 142 143 144 145 146 147   25 169 170 171 172 173 174 175   
+22 148 149 150 151               26 176 177 178 179 180 181       
+                                                                  
              July                            August            
    Mon Tue Wed Thu Fri Sat Sun      Mon Tue Wed Thu Fri Sat Sun
-26                         182   30                         213   
-27 183 184 185 186 187 188 189   31 214 215 216 217 218 219 220   
-28 190 191 192 193 194 195 196   32 221 222 223 224 225 226 227   
-29 197 198 199 200 201 202 203   33 228 229 230 231 232 233 234   
-30 204 205 206 207 208 209 210   34 235 236 237 238 239 240 241   
-31 211 212                       35 242 243                       
+26                         182   31         213 214 215 216 217   
+27 183 184 185 186 187 188 189   32 218 219 220 221 222 223 224   
+28 190 191 192 193 194 195 196   33 225 226 227 228 229 230 231   
+29 197 198 199 200 201 202 203   34 232 233 234 235 236 237 238   
+30 204 205 206 207 208 209 210   35 239 240 241 242 243           
+31 211 212                                                        
            September                         October           
    Mon Tue Wed Thu Fri Sat Sun      Mon Tue Wed Thu Fri Sat Sun
-35                         244   39                         274   
-36 245 246 247 248 249 250 251   40 275 276 277 278 279 280 281   
-37 252 253 254 255 256 257 258   41 282 283 284 285 286 287 288   
-38 259 260 261 262 263 264 265   42 289 290 291 292 293 294 295   
-39 266 267 268 269 270 271 272   43 296 297 298 299 300 301 302   
-40 273                           44 303 304                       
+35                     244 245   40 274 275 276 277 278 279 280   
+36 246 247 248 249 250 251 252   41 281 282 283 284 285 286 287   
+37 253 254 255 256 257 258 259   42 288 289 290 291 292 293 294   
+38 260 261 262 263 264 265 266   43 295 296 297 298 299 300 301   
+39 267 268 269 270 271 272 273   44 302 303 304                   
+                                                                  
            November                         December           
    Mon Tue Wed Thu Fri Sat Sun      Mon Tue Wed Thu Fri Sat Sun
-43                         305   48                         335   
-44 306 307 308 309 310 311 312   49 336 337 338 339 340 341 342   
-45 313 314 315 316 317 318 319   50 343 344 345 346 347 348 349   
-46 320 321 322 323 324 325 326   51 350 351 352 353 354 355 356   
-47 327 328 329 330 331 332 333   52 357 358 359 360 361 362 363   
-48 334                           52 364 365                       
+44             305 306 307 308   48                     335 336   
+45 309 310 311 312 313 314 315   49 337 338 339 340 341 342 343   
+46 316 317 318 319 320 321 322   50 344 345 346 347 348 349 350   
+47 323 324 325 326 327 328 329   51 351 352 353 354 355 356 357   
+48 330 331 332 333 334           52 358 359 360 361 362 363 364   
+                                  1 365                           
 
 Julian - Sunday-based year with week numbers
                            2147483646                          
 
             January                         February           
    Sun Mon Tue Wed Thu Fri Sat      Sun Mon Tue Wed Thu Fri Sat
-51   1   2   3   4   5   6   7    4  32  33  34  35  36  37  38   
-52   8   9  10  11  12  13  14    5  39  40  41  42  43  44  45   
-51  15  16  17  18  19  20  21    6  46  47  48  49  50  51  52   
-52  22  23  24  25  26  27  28    7  53  54  55  56  57  58  59   
-51  29  30  31                                                    
+53       1   2   3   4   5   6    4                  32  33  34   
+ 1   7   8   9  10  11  12  13    5  35  36  37  38  39  40  41   
+ 2  14  15  16  17  18  19  20    6  42  43  44  45  46  47  48   
+ 3  21  22  23  24  25  26  27    7  49  50  51  52  53  54  55   
+ 4  28  29  30  31                8  56  57  58  59               
                                                                   
              March                            April            
    Sun Mon Tue Wed Thu Fri Sat      Sun Mon Tue Wed Thu Fri Sat
- 8  60  61  62  63  64  65  66   12  91  92  93  94  95  96  97   
- 9  67  68  69  70  71  72  73   13  98  99 100 101 102 103 104   
-10  74  75  76  77  78  79  80   14 105 106 107 108 109 110 111   
-11  81  82  83  84  85  86  87   15 112 113 114 115 116 117 118   
-12  88  89  90                   16 119 120                       
+ 8                  60  61  62   13  91  92  93  94  95  96  97   
+ 9  63  64  65  66  67  68  69   14  98  99 100 101 102 103 104   
+10  70  71  72  73  74  75  76   15 105 106 107 108 109 110 111   
+11  77  78  79  80  81  82  83   16 112 113 114 115 116 117 118   
+12  84  85  86  87  88  89  90   17 119 120                       
                                                                   
               May                             June             
    Sun Mon Tue Wed Thu Fri Sat      Sun Mon Tue Wed Thu Fri Sat
-16 121 122 123 124 125 126 127   21 152 153 154 155 156 157 158   
-17 128 129 130 131 132 133 134   22 159 160 161 162 163 164 165   
-18 135 136 137 138 139 140 141   23 166 167 168 169 170 171 172   
-19 142 143 144 145 146 147 148   24 173 174 175 176 177 178 179   
-20 149 150 151                   25 180 181                       
+17         121 122 123 124 125   21                     152 153   
+18 126 127 128 129 130 131 132   22 154 155 156 157 158 159 160   
+19 133 134 135 136 137 138 139   23 161 162 163 164 165 166 167   
+20 140 141 142 143 144 145 146   24 168 169 170 171 172 173 174   
+21 147 148 149 150 151           25 175 176 177 178 179 180 181   
                                                                   
              July                            August            
    Sun Mon Tue Wed Thu Fri Sat      Sun Mon Tue Wed Thu Fri Sat
-25 182 183 184 185 186 187 188   29 213 214 215 216 217 218 219   
-26 189 190 191 192 193 194 195   30 220 221 222 223 224 225 226   
-27 196 197 198 199 200 201 202   31 227 228 229 230 231 232 233   
-28 203 204 205 206 207 208 209   32 234 235 236 237 238 239 240   
-29 210 211 212                   33 241 242 243                   
+26 182 183 184 185 186 187 188   30             213 214 215 216   
+27 189 190 191 192 193 194 195   31 217 218 219 220 221 222 223   
+28 196 197 198 199 200 201 202   32 224 225 226 227 228 229 230   
+29 203 204 205 206 207 208 209   33 231 232 233 234 235 236 237   
+30 210 211 212                   34 238 239 240 241 242 243       
                                                                   
            September                         October           
    Sun Mon Tue Wed Thu Fri Sat      Sun Mon Tue Wed Thu Fri Sat
-34 244 245 246 247 248 249 250   38 274 275 276 277 278 279 280   
-35 251 252 253 254 255 256 257   39 281 282 283 284 285 286 287   
-36 258 259 260 261 262 263 264   40 288 289 290 291 292 293 294   
-37 265 266 267 268 269 270 271   41 295 296 297 298 299 300 301   
-38 272 273                       42 302 303 304                   
-                                                                  
+34                         244   39     274 275 276 277 278 279   
+35 245 246 247 248 249 250 251   40 280 281 282 283 284 285 286   
+36 252 253 254 255 256 257 258   41 287 288 289 290 291 292 293   
+37 259 260 261 262 263 264 265   42 294 295 296 297 298 299 300   
+38 266 267 268 269 270 271 272   43 301 302 303 304               
+39 273                                                            
            November                         December           
    Sun Mon Tue Wed Thu Fri Sat      Sun Mon Tue Wed Thu Fri Sat
-43 305 306 307 308 309 310 311   47 335 336 337 338 339 340 341   
-44 312 313 314 315 316 317 318   48 342 343 344 345 346 347 348   
-45 319 320 321 322 323 324 325   49 349 350 351 352 353 354 355   
-46 326 327 328 329 330 331 332   50 356 357 358 359 360 361 362   
-47 333 334                       51 363 364 365                   
-                                                                  
+43                 305 306 307   47                         335   
+44 308 309 310 311 312 313 314   48 336 337 338 339 340 341 342   
+45 315 316 317 318 319 320 321   49 343 344 345 346 347 348 349   
+46 322 323 324 325 326 327 328   50 350 351 352 353 354 355 356   
+47 329 330 331 332 333 334       51 357 358 359 360 361 362 363   
+                                 52 364 365                       
 
-- 
2.1.3


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 03/10] more: fix unsigned integer overflow [AddressSanitizer]
  2014-11-30 13:57 [PATCH 00/10] pull: AddressSanitizer round II Sami Kerola
  2014-11-30 13:57 ` [PATCH 01/10] lib/mbalign: fix unsigned integer overflow [AddressSanitizer] Sami Kerola
  2014-11-30 13:57 ` [PATCH 02/10] cal: fix signed " Sami Kerola
@ 2014-11-30 13:57 ` Sami Kerola
  2014-12-08 11:42   ` Karel Zak
  2014-11-30 13:57 ` [PATCH 04/10] lib: fix crc32 and crc64 interger overflows [AddressSanitizer] Sami Kerola
                   ` (9 subsequent siblings)
  12 siblings, 1 reply; 34+ messages in thread
From: Sami Kerola @ 2014-11-30 13:57 UTC (permalink / raw)
  To: util-linux; +Cc: Sami Kerola

text-utils/more.c:1137:20: runtime error: unsigned integer overflow: 0 -
1 cannot be represented in type 'size_t' (aka 'unsigned long')
text-utils/more.c:1139:7: runtime error: unsigned integer overflow: 2 +
18446744073709551615 cannot be represented in type 'unsigned long'

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 text-utils/more.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/text-utils/more.c b/text-utils/more.c
index a489953..4b03e0d 100644
--- a/text-utils/more.c
+++ b/text-utils/more.c
@@ -1125,14 +1125,14 @@ void prbuf(register char *s, register int n)
 #ifdef HAVE_WIDECHAR
 			{
 				wchar_t wc;
-				size_t mblength;
+				ssize_t mblength;
 				mbstate_t mbstate;
 				memset(&mbstate, '\0', sizeof(mbstate_t));
 				s--;
 				n++;
 				mblength = mbrtowc(&wc, s, n, &mbstate);
-				if (mblength == (size_t)-2
-				    || mblength == (size_t)-1)
+				if (mblength == -2
+				    || mblength == -1)
 					mblength = 1;
 				while (mblength--)
 					putchar(*s++);
-- 
2.1.3


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 04/10] lib: fix crc32 and crc64 interger overflows [AddressSanitizer]
  2014-11-30 13:57 [PATCH 00/10] pull: AddressSanitizer round II Sami Kerola
                   ` (2 preceding siblings ...)
  2014-11-30 13:57 ` [PATCH 03/10] more: fix unsigned " Sami Kerola
@ 2014-11-30 13:57 ` Sami Kerola
  2014-11-30 13:57 ` [PATCH 05/10] fdisk: (sgi) fix unsigned integer overflow [AddressSanitizer] Sami Kerola
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 34+ messages in thread
From: Sami Kerola @ 2014-11-30 13:57 UTC (permalink / raw)
  To: util-linux; +Cc: Sami Kerola

lib/crc32.c:111:11: runtime error: unsigned integer overflow: 0 - 1
cannot be represented in type 'size_t' (aka 'unsigned long')

lib/crc64.c:101:12: runtime error: unsigned integer overflow: 0 - 1
cannot be represented in type 'size_t' (aka 'unsigned long')

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 lib/crc32.c | 4 +++-
 lib/crc64.c | 3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/crc32.c b/lib/crc32.c
index eaaa06a..be98f1a 100644
--- a/lib/crc32.c
+++ b/lib/crc32.c
@@ -108,8 +108,10 @@ uint32_t crc32(uint32_t seed, const unsigned char *buf, size_t len)
 	uint32_t crc = seed;
 	const unsigned char *p = buf;
 
-	while(len-- > 0)
+	while (len) {
 		crc = crc32_tab[(crc ^ *p++) & 0xff] ^ (crc >> 8);
+		len--;
+	}
 
 	return crc;
 }
diff --git a/lib/crc64.c b/lib/crc64.c
index 091e95d..0be78e6 100644
--- a/lib/crc64.c
+++ b/lib/crc64.c
@@ -98,9 +98,10 @@ uint64_t crc64(uint64_t seed, const unsigned char *data, size_t len)
 {
 	uint64_t crc = seed;
 
-	while (len--) {
+	while (len) {
 		int i = ((int) (crc >> 56) ^ *data++) & 0xFF;
 		crc = crc64_tab[i] ^ (crc << 8);
+		len--;
 	}
 
 	return crc;
-- 
2.1.3


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 05/10] fdisk: (sgi) fix unsigned integer overflow [AddressSanitizer]
  2014-11-30 13:57 [PATCH 00/10] pull: AddressSanitizer round II Sami Kerola
                   ` (3 preceding siblings ...)
  2014-11-30 13:57 ` [PATCH 04/10] lib: fix crc32 and crc64 interger overflows [AddressSanitizer] Sami Kerola
@ 2014-11-30 13:57 ` Sami Kerola
  2014-11-30 13:57 ` [PATCH 06/10] strutils: fix unsigned integer overflows [AddressSanitizer] Sami Kerola
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 34+ messages in thread
From: Sami Kerola @ 2014-11-30 13:57 UTC (permalink / raw)
  To: util-linux; +Cc: Sami Kerola

include/pt-sgi.h:103:7: runtime error: unsigned integer overflow: 0 -
1186450447 cannot be represented in type 'unsigned int'

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 include/pt-sgi.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/pt-sgi.h b/include/pt-sgi.h
index 15f355b..547b37a 100644
--- a/include/pt-sgi.h
+++ b/include/pt-sgi.h
@@ -99,8 +99,10 @@ static inline uint32_t sgi_pt_checksum(struct sgi_disklabel *label)
 
 	i = sizeof(*label) / sizeof(*ptr);
 
-	while (i--)
+	while (i) {
+		i--;
 		sum -= be32_to_cpu(ptr[i]);
+	}
 
 	return sum;
 }
-- 
2.1.3


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 06/10] strutils: fix unsigned integer overflows [AddressSanitizer]
  2014-11-30 13:57 [PATCH 00/10] pull: AddressSanitizer round II Sami Kerola
                   ` (4 preceding siblings ...)
  2014-11-30 13:57 ` [PATCH 05/10] fdisk: (sgi) fix unsigned integer overflow [AddressSanitizer] Sami Kerola
@ 2014-11-30 13:57 ` Sami Kerola
  2014-11-30 13:57 ` [PATCH 07/10] mkfs.cramfs: fix unsigned integer overflow [AddressSanitizer] Sami Kerola
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 34+ messages in thread
From: Sami Kerola @ 2014-11-30 13:57 UTC (permalink / raw)
  To: util-linux; +Cc: Sami Kerola

include/strutils.h:174:10: runtime error: unsigned integer overflow: 0 -
1 cannot be represented in type 'size_t' (aka 'unsigned long')

include/strutils.h:178:6: runtime error: unsigned integer overflow:
18446744073709551615 + 1 cannot be represented in type 'size_t' (aka
'unsigned long')

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 include/strutils.h | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/include/strutils.h b/include/strutils.h
index cfe8a95..4d8463a 100644
--- a/include/strutils.h
+++ b/include/strutils.h
@@ -171,11 +171,14 @@ static inline size_t rtrim_whitespace(unsigned char *str)
 {
 	size_t i = strlen((char *) str);
 
-	while (i--) {
-		if (!isspace(str[i]))
+	while (i) {
+		i--;
+		if (!isspace(str[i])) {
+			i++;
 			break;
+		}
 	}
-	str[++i] = '\0';
+	str[i] = '\0';
 	return i;
 }
 
-- 
2.1.3


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 07/10] mkfs.cramfs: fix unsigned integer overflow [AddressSanitizer]
  2014-11-30 13:57 [PATCH 00/10] pull: AddressSanitizer round II Sami Kerola
                   ` (5 preceding siblings ...)
  2014-11-30 13:57 ` [PATCH 06/10] strutils: fix unsigned integer overflows [AddressSanitizer] Sami Kerola
@ 2014-11-30 13:57 ` Sami Kerola
  2014-12-08 11:37   ` Karel Zak
  2014-11-30 13:57 ` [PATCH 08/10] include/c: define UL_ASAN_BLACKLIST address_sanitizer function attribute Sami Kerola
                   ` (5 subsequent siblings)
  12 siblings, 1 reply; 34+ messages in thread
From: Sami Kerola @ 2014-11-30 13:57 UTC (permalink / raw)
  To: util-linux; +Cc: Sami Kerola

disk-utils/mkfs.cramfs.c:622:20: runtime error: unsigned integer
overflow: 64 - 512 cannot be represented in type 'unsigned long'

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 disk-utils/mkfs.cramfs.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/disk-utils/mkfs.cramfs.c b/disk-utils/mkfs.cramfs.c
index bae68ec..d9a9153 100644
--- a/disk-utils/mkfs.cramfs.c
+++ b/disk-utils/mkfs.cramfs.c
@@ -619,7 +619,10 @@ do_compress(char *base, unsigned int offset, unsigned char const *name,
 	/* TODO: Arguably, original_size in these 2 lines should be
 	   st_blocks * 512.  But if you say that, then perhaps
 	   administrative data should also be included in both. */
-	change = new_size - original_size;
+	if (new_size <= original_size)
+		change = new_size - original_size;
+	else
+		change = new_size;
 	if (verbose)
 		printf(_("%6.2f%% (%+ld bytes)\t%s\n"),
 		       (change * 100) / (double) original_size, change, name);
-- 
2.1.3


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 08/10] include/c: define UL_ASAN_BLACKLIST address_sanitizer function attribute
  2014-11-30 13:57 [PATCH 00/10] pull: AddressSanitizer round II Sami Kerola
                   ` (6 preceding siblings ...)
  2014-11-30 13:57 ` [PATCH 07/10] mkfs.cramfs: fix unsigned integer overflow [AddressSanitizer] Sami Kerola
@ 2014-11-30 13:57 ` Sami Kerola
  2014-11-30 16:42   ` Benno Schulenberg
  2014-11-30 13:57 ` [PATCH 09/10] lscpu: blacklist vmware_bdoor() AddressSanitizer check Sami Kerola
                   ` (4 subsequent siblings)
  12 siblings, 1 reply; 34+ messages in thread
From: Sami Kerola @ 2014-11-30 13:57 UTC (permalink / raw)
  To: util-linux; +Cc: Sami Kerola

The UL_ASAN_BLACKLIST allows AddressSanitizer to be set off for functions
that cannot be checked.

Reference: http://dxr.mozilla.org/mozilla-central/source/mfbt/Attributes.h
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 include/c.h | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/include/c.h b/include/c.h
index 0f6e5b2..223f3a7 100644
--- a/include/c.h
+++ b/include/c.h
@@ -313,4 +313,21 @@ static inline int xusleep(useconds_t usec)
 #define stringify_value(s) stringify(s)
 #define stringify(s) #s
 
+/*
+ * UL_ASAN_BLACKLIST is a macro to tell AddressSanitizer (a compile-time
+ * instrumentation shipped with Clang and GCC) to not instrument the
+ * annotated function.  Furthermore, it will prevent the compiler from
+ * inlining the function because inlining currently breaks the blacklisting
+ * mechanism of AddressSanitizer.
+ */
+#if defined(__has_feature)
+# if __has_feature(address_sanitizer)
+#  define UL_ASAN_BLACKLIST __attribute__((noinline)) __attribute__((no_sanitize_memory)) __attribute__((no_sanitize_address))
+# else
+#  define UL_ASAN_BLACKLIST	/* nothing */
+# endif
+#else
+# define UL_ASAN_BLACKLIST	/* nothing */
+#endif
+
 #endif /* UTIL_LINUX_C_H */
-- 
2.1.3


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 09/10] lscpu: blacklist vmware_bdoor() AddressSanitizer check
  2014-11-30 13:57 [PATCH 00/10] pull: AddressSanitizer round II Sami Kerola
                   ` (7 preceding siblings ...)
  2014-11-30 13:57 ` [PATCH 08/10] include/c: define UL_ASAN_BLACKLIST address_sanitizer function attribute Sami Kerola
@ 2014-11-30 13:57 ` Sami Kerola
  2014-11-30 16:34   ` Benno Schulenberg
  2014-11-30 13:57 ` [PATCH 10/10] ipcs: fix two data type errors [AddressSanitizer] Sami Kerola
                   ` (3 subsequent siblings)
  12 siblings, 1 reply; 34+ messages in thread
From: Sami Kerola @ 2014-11-30 13:57 UTC (permalink / raw)
  To: util-linux; +Cc: Sami Kerola

AddressSanitizer is identifying the __asm__ segment as suspicious.

==1215==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000
(pc 0x0000004ccffd bp 0x7fff9b7184f0 sp 0x7fff9b7184e0 T0)
    #0 0x4ccffc in vmware_bdoor /home/src/util-linux/sys-utils/lscpu.c:660

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 sys-utils/lscpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
index c272dc2..c7d6f9f 100644
--- a/sys-utils/lscpu.c
+++ b/sys-utils/lscpu.c
@@ -655,7 +655,7 @@ read_hypervisor_powerpc(struct lscpu_desc *desc)
 #define VMWARE_BDOOR_PORT           0x5658
 #define VMWARE_BDOOR_CMD_GETVERSION 10
 
-static inline
+static inline UL_ASAN_BLACKLIST
 void vmware_bdoor(uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx)
 {
 	__asm__(
-- 
2.1.3


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 10/10] ipcs: fix two data type errors [AddressSanitizer]
  2014-11-30 13:57 [PATCH 00/10] pull: AddressSanitizer round II Sami Kerola
                   ` (8 preceding siblings ...)
  2014-11-30 13:57 ` [PATCH 09/10] lscpu: blacklist vmware_bdoor() AddressSanitizer check Sami Kerola
@ 2014-11-30 13:57 ` Sami Kerola
  2014-12-08 12:21   ` Karel Zak
  2014-11-30 14:03 ` [PATCH 00/10] pull: AddressSanitizer round II Sami Kerola
                   ` (2 subsequent siblings)
  12 siblings, 1 reply; 34+ messages in thread
From: Sami Kerola @ 2014-11-30 13:57 UTC (permalink / raw)
  To: util-linux; +Cc: Sami Kerola

==3218==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fffa577e2b0 at pc 0x4501f9 bp 0x7fffa577e130 sp 0x7fffa577e108
WRITE of size 112 at 0x7fffa577e2b0 thread T0
    #0 0x4501f8 in shmctl /home/users/aadgrand/LLVM/releases/ubuntu/final/llvm.src/projects/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc:2502
    #1 0x48bd13 in ipc_shm_get_info /home/travis/build/kerolasa/lelux-utiliteetit/sys-utils/ipcutils.c:157
    #2 0x488884 in do_shm /home/travis/build/kerolasa/lelux-utiliteetit/sys-utils/ipcs.c:279
    #3 0x4844a8 in main /home/travis/build/kerolasa/lelux-utiliteetit/sys-utils/ipcs.c:175
    #4 0x2afb3f8c176c (/lib/x86_64-linux-gnu/libc.so.6+0x2176c)
    #5 0x48408c in _start (/home/travis/build/kerolasa/lelux-utiliteetit/ipcs+0x48408c)

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 sys-utils/ipcutils.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-utils/ipcutils.c b/sys-utils/ipcutils.c
index c45162a..3d5249c 100644
--- a/sys-utils/ipcutils.c
+++ b/sys-utils/ipcutils.c
@@ -98,7 +98,7 @@ int ipc_shm_get_info(int id, struct shm_data **shmds)
 	FILE *f;
 	int i = 0, maxid;
 	struct shm_data *p;
-	struct shm_info dummy;
+	struct shmid_ds dummy;
 
 	p = *shmds = xcalloc(1, sizeof(struct shm_data));
 	p->next = NULL;
@@ -154,7 +154,7 @@ int ipc_shm_get_info(int id, struct shm_data **shmds)
 
 	/* Fallback; /proc or /sys file(s) missing. */
 shm_fallback:
-	maxid = shmctl(0, SHM_INFO, (struct shmid_ds *) &dummy);
+	maxid = shmctl(0, SHM_INFO, &dummy);
 
 	for (int j = 0; j <= maxid; j++) {
 		int shmid;
-- 
2.1.3


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* Re: [PATCH 00/10] pull: AddressSanitizer round II
  2014-11-30 13:57 [PATCH 00/10] pull: AddressSanitizer round II Sami Kerola
                   ` (9 preceding siblings ...)
  2014-11-30 13:57 ` [PATCH 10/10] ipcs: fix two data type errors [AddressSanitizer] Sami Kerola
@ 2014-11-30 14:03 ` Sami Kerola
  2014-12-15  9:15 ` Karel Zak
  2014-12-19 13:23 ` Karel Zak
  12 siblings, 0 replies; 34+ messages in thread
From: Sami Kerola @ 2014-11-30 14:03 UTC (permalink / raw)
  To: util-linux; +Cc: Sami Kerola

On 30 November 2014 at 13:57, Sami Kerola <kerolasa@iki.fi> wrote:
> Here comes the second set of changes to enable AddressSanitizer one day

Oops. I forgot to mention the changes are available in the git repository at:

  git://github.com/kerolasa/lelux-utiliteetit.git asan2

-- 
Sami Kerola
http://www.iki.fi/kerolasa/

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 09/10] lscpu: blacklist vmware_bdoor() AddressSanitizer check
  2014-11-30 13:57 ` [PATCH 09/10] lscpu: blacklist vmware_bdoor() AddressSanitizer check Sami Kerola
@ 2014-11-30 16:34   ` Benno Schulenberg
  2014-11-30 17:17     ` Sami Kerola
  2014-11-30 17:27     ` Drake Wilson
  0 siblings, 2 replies; 34+ messages in thread
From: Benno Schulenberg @ 2014-11-30 16:34 UTC (permalink / raw)
  To: Sami Kerola; +Cc: Util-Linux


On Sun, Nov 30, 2014, at 14:57, Sami Kerola wrote:
> AddressSanitizer is identifying the __asm__ segment as suspicious.

Hmm...  How come that it doesn't flag the very similar segment in
static inline void cpuid(...) as suspicious?  Is it the 'inl' command?
(What does this do anyway?  It isn't an x86 assembly that I can find.)

> -static inline
> +static inline UL_ASAN_BLACKLIST
>  void vmware_bdoor(uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx)

While here, maybe move the 'void' to the previous line?

Benno

-- 
http://www.fastmail.com - Does exactly what it says on the tin


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 08/10] include/c: define UL_ASAN_BLACKLIST address_sanitizer function attribute
  2014-11-30 13:57 ` [PATCH 08/10] include/c: define UL_ASAN_BLACKLIST address_sanitizer function attribute Sami Kerola
@ 2014-11-30 16:42   ` Benno Schulenberg
  2014-12-19  9:50     ` Sami Kerola
  0 siblings, 1 reply; 34+ messages in thread
From: Benno Schulenberg @ 2014-11-30 16:42 UTC (permalink / raw)
  To: Sami Kerola; +Cc: Util-Linux


On Sun, Nov 30, 2014, at 14:57, Sami Kerola wrote:
> The UL_ASAN_BLACKLIST allows AddressSanitizer to be set off for functions
> that cannot be checked.

s/set/switched/

(Because "set off" means "triggered", which means "run" -- but
the intention is to say "not run".)

> + *   Furthermore, it will prevent the compiler from
> + * inlining the function because inlining currently breaks the blacklisting
> + * mechanism of AddressSanitizer.

Ow...  Could uninlining something in some rare cases not break
the function of that something?

Benno

-- 
http://www.fastmail.com - The way an email service should be


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 09/10] lscpu: blacklist vmware_bdoor() AddressSanitizer check
  2014-11-30 16:34   ` Benno Schulenberg
@ 2014-11-30 17:17     ` Sami Kerola
  2014-11-30 17:27     ` Drake Wilson
  1 sibling, 0 replies; 34+ messages in thread
From: Sami Kerola @ 2014-11-30 17:17 UTC (permalink / raw)
  To: Benno Schulenberg; +Cc: Util-Linux

On 30 November 2014 at 16:34, Benno Schulenberg <bensberg@justemail.net> wrote:
> On Sun, Nov 30, 2014, at 14:57, Sami Kerola wrote:
>> AddressSanitizer is identifying the __asm__ segment as suspicious.
>
> Hmm...  How come that it doesn't flag the very similar segment in
> static inline void cpuid(...) as suspicious?  Is it the 'inl' command?
> (What does this do anyway?  It isn't an x86 assembly that I can find.)

I don't understand assembly enough to tell why that worked but not this.

>> -static inline
>> +static inline UL_ASAN_BLACKLIST
>>  void vmware_bdoor(uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx)
>
> While here, maybe move the 'void' to the previous line?

I can do that.

Unless more radical approach is considered correct. The vmware_bdoor() came from

commit  b7744730f6e4b5b91c9846f3e7c58aaa7423a167

and the code looks remarkably similar as

http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/x86/kernel/cpu/vmware.c#n30

The kernel code is setting in vmware_platform() hyper_vendor_id that
lscpu consumes with read_hypervisor_cpuid(). Perhaps the
vmware_bdoor() can be removed.

-- 
Sami Kerola
http://www.iki.fi/kerolasa/

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 09/10] lscpu: blacklist vmware_bdoor() AddressSanitizer check
  2014-11-30 16:34   ` Benno Schulenberg
  2014-11-30 17:17     ` Sami Kerola
@ 2014-11-30 17:27     ` Drake Wilson
  1 sibling, 0 replies; 34+ messages in thread
From: Drake Wilson @ 2014-11-30 17:27 UTC (permalink / raw)
  To: Benno Schulenberg; +Cc: Sami Kerola, Util-Linux

Benno Schulenberg wrote:
> Hmm...  How come that it doesn't flag the very similar segment in
> static inline void cpuid(...) as suspicious?  Is it the 'inl' command?
> (What does this do anyway?  It isn't an x86 assembly that I can find.)

The IN does a read from I/O port space; the "l" suffix in AT&T syntax means
32-bit operand size.  I'm guessing AddressSanitizer sees what looks like a
memory reference with 16-bit address size coming from nowhere that should
have a pointer in it and complains.  It's not a "real" memory reference,
so ignoring the whole function seems reasonable.  (It's very unusual to use
that instruction from userspace, so it's not surprising it wouldn't be
recognized.)

   ---> Drake Wilson


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 01/10] lib/mbalign: fix unsigned integer overflow [AddressSanitizer]
  2014-11-30 13:57 ` [PATCH 01/10] lib/mbalign: fix unsigned integer overflow [AddressSanitizer] Sami Kerola
@ 2014-12-03 23:53   ` Pádraig Brady
  2014-12-04 20:14     ` Sami Kerola
  2014-12-04 11:51   ` Pádraig Brady
  1 sibling, 1 reply; 34+ messages in thread
From: Pádraig Brady @ 2014-12-03 23:53 UTC (permalink / raw)
  To: Sami Kerola, util-linux

On 30/11/14 13:57, Sami Kerola wrote:
> This error was reported 155 times.
> 
> lib/mbsalign.c:322:18: runtime error: unsigned integer overflow: 0 - 1
> cannot be represented in type 'size_t' (aka 'unsigned long')
> 
> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
> ---
>  lib/mbsalign.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/mbsalign.c b/lib/mbsalign.c
> index b307d19..052fec6 100644
> --- a/lib/mbsalign.c
> +++ b/lib/mbsalign.c
> @@ -319,7 +319,7 @@ mbs_align_pad (char *dest, const char* dest_end, size_t n_spaces)
>  {
>    /* FIXME: Should we pad with "figure space" (\u2007)
>       if non ascii data present?  */
> -  while (n_spaces-- && (dest < dest_end))
> +  for (/* nothing */; n_spaces && (dest < dest_end); n_spaces--)
>      *dest++ = ' ';
>    *dest = '\0';
>    return dest;
> 

What compiler and version are you using for this?
I don't get the error with gcc 4.9.2 with -fsanitize=undefined
Note the error is incorrect I think as the variable is not read
after the overflow.

thanks,
Pádraig.

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 01/10] lib/mbalign: fix unsigned integer overflow [AddressSanitizer]
  2014-11-30 13:57 ` [PATCH 01/10] lib/mbalign: fix unsigned integer overflow [AddressSanitizer] Sami Kerola
  2014-12-03 23:53   ` Pádraig Brady
@ 2014-12-04 11:51   ` Pádraig Brady
  1 sibling, 0 replies; 34+ messages in thread
From: Pádraig Brady @ 2014-12-04 11:51 UTC (permalink / raw)
  To: Sami Kerola, util-linux

On 30/11/14 13:57, Sami Kerola wrote:
> This error was reported 155 times.
> 
> lib/mbsalign.c:322:18: runtime error: unsigned integer overflow: 0 - 1
> cannot be represented in type 'size_t' (aka 'unsigned long')
> 
> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
> ---
>  lib/mbsalign.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/mbsalign.c b/lib/mbsalign.c
> index b307d19..052fec6 100644
> --- a/lib/mbsalign.c
> +++ b/lib/mbsalign.c
> @@ -319,7 +319,7 @@ mbs_align_pad (char *dest, const char* dest_end, size_t n_spaces)
>  {
>    /* FIXME: Should we pad with "figure space" (\u2007)
>       if non ascii data present?  */
> -  while (n_spaces-- && (dest < dest_end))
> +  for (/* nothing */; n_spaces && (dest < dest_end); n_spaces--)
>      *dest++ = ' ';
>    *dest = '\0';
>    return dest;

What compiler and version are you using for this?
I don't get the error with gcc 4.9.2 with -fsanitize=undefined
Note the error is incorrect I think as the variable is not read
after the overflow.

thanks,
Pádraig.

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 01/10] lib/mbalign: fix unsigned integer overflow [AddressSanitizer]
  2014-12-03 23:53   ` Pádraig Brady
@ 2014-12-04 20:14     ` Sami Kerola
  2014-12-07 11:56       ` Pádraig Brady
  0 siblings, 1 reply; 34+ messages in thread
From: Sami Kerola @ 2014-12-04 20:14 UTC (permalink / raw)
  To: Pádraig Brady; +Cc: util-linux

On 3 December 2014 at 23:53, Pádraig Brady <P@draigbrady.com> wrote:
> On 30/11/14 13:57, Sami Kerola wrote:
>> This error was reported 155 times.
>>
>> lib/mbsalign.c:322:18: runtime error: unsigned integer overflow: 0 - 1
>> cannot be represented in type 'size_t' (aka 'unsigned long')
>
> What compiler and version are you using for this?
> I don't get the error with gcc 4.9.2 with -fsanitize=undefined
> Note the error is incorrect I think as the variable is not read
> after the overflow.

Hi Pádraig,

Sorry it took ages to reply to a trivial question.

$ clang --version
clang version 3.5.0 (tags/RELEASE_350/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix

I have not done sanitation runs with gcc.

The system is archlinux with testing repos enabled with daily updates,
that should mean a lot of libraries and such are fairly recent.

-- 
Sami Kerola
http://www.iki.fi/kerolasa/

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 01/10] lib/mbalign: fix unsigned integer overflow [AddressSanitizer]
  2014-12-04 20:14     ` Sami Kerola
@ 2014-12-07 11:56       ` Pádraig Brady
  2014-12-08 11:00         ` Karel Zak
  0 siblings, 1 reply; 34+ messages in thread
From: Pádraig Brady @ 2014-12-07 11:56 UTC (permalink / raw)
  To: kerolasa; +Cc: util-linux

On 04/12/14 20:14, Sami Kerola wrote:
> On 3 December 2014 at 23:53, Pádraig Brady <P@draigbrady.com> wrote:
>> On 30/11/14 13:57, Sami Kerola wrote:
>>> This error was reported 155 times.
>>>
>>> lib/mbsalign.c:322:18: runtime error: unsigned integer overflow: 0 - 1
>>> cannot be represented in type 'size_t' (aka 'unsigned long')
>>
>> What compiler and version are you using for this?
>> I don't get the error with gcc 4.9.2 with -fsanitize=undefined
>> Note the error is incorrect I think as the variable is not read
>> after the overflow.
> 
> Hi Pádraig,
> 
> Sorry it took ages to reply to a trivial question.
> 
> $ clang --version
> clang version 3.5.0 (tags/RELEASE_350/final)
> Target: x86_64-unknown-linux-gnu
> Thread model: posix
> 
> I have not done sanitation runs with gcc.
> 
> The system is archlinux with testing repos enabled with daily updates,
> that should mean a lot of libraries and such are fairly recent.

Thanks for the info.
BTW I don't see it with clang 3.4.2.
This seems like a too problematic warning TBH,
as unsigned overflow is defined,
the overflow value is not used in this case,
this seems like a very common idiom.

thanks,
Pádraig.

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 01/10] lib/mbalign: fix unsigned integer overflow [AddressSanitizer]
  2014-12-07 11:56       ` Pádraig Brady
@ 2014-12-08 11:00         ` Karel Zak
  0 siblings, 0 replies; 34+ messages in thread
From: Karel Zak @ 2014-12-08 11:00 UTC (permalink / raw)
  To: Pádraig Brady; +Cc: kerolasa, util-linux

On Sun, Dec 07, 2014 at 11:56:05AM +0000, Pádraig Brady wrote:
> On 04/12/14 20:14, Sami Kerola wrote:
> > On 3 December 2014 at 23:53, Pádraig Brady <P@draigbrady.com> wrote:
> >> On 30/11/14 13:57, Sami Kerola wrote:
> >>> This error was reported 155 times.
> >>>
> >>> lib/mbsalign.c:322:18: runtime error: unsigned integer overflow: 0 - 1
> >>> cannot be represented in type 'size_t' (aka 'unsigned long')
> >>
> >> What compiler and version are you using for this?
> >> I don't get the error with gcc 4.9.2 with -fsanitize=undefined
> >> Note the error is incorrect I think as the variable is not read
> >> after the overflow.
> > 
> > Hi Pádraig,
> > 
> > Sorry it took ages to reply to a trivial question.
> > 
> > $ clang --version
> > clang version 3.5.0 (tags/RELEASE_350/final)
> > Target: x86_64-unknown-linux-gnu
> > Thread model: posix
> > 
> > I have not done sanitation runs with gcc.
> > 
> > The system is archlinux with testing repos enabled with daily updates,
> > that should mean a lot of libraries and such are fairly recent.
> 
> Thanks for the info.
> BTW I don't see it with clang 3.4.2.
> This seems like a too problematic warning TBH,
> as unsigned overflow is defined,
> the overflow value is not used in this case,
> this seems like a very common idiom.

 Yes, the question is if this is a good idiom ;-) IMHO it would be
 better to have robust and more explicit code where unsigned numbers
 never overflow. You're right the code is correct for now, but maybe
 one day someone will edit the code and introduce unexpected bug with
 unsigned...

    Karel


-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 02/10] cal: fix signed integer overflow [AddressSanitizer]
  2014-11-30 13:57 ` [PATCH 02/10] cal: fix signed " Sami Kerola
@ 2014-12-08 11:07   ` Karel Zak
  0 siblings, 0 replies; 34+ messages in thread
From: Karel Zak @ 2014-12-08 11:07 UTC (permalink / raw)
  To: Sami Kerola; +Cc: util-linux

On Sun, Nov 30, 2014 at 01:57:34PM +0000, Sami Kerola wrote:
>   November 2147483646   December 2147483646   January 2147483647 
>  Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa
> - 1  2  3  4  5  6  7   1  2  3  4  5  6  7   1  2  3  4  5  6  7 
> - 8  9 10 11 12 13 14   8  9 10 11 12 13 14   8  9 10 11 12 13 14 
> -15 16 17 18 19 20 21  15 16 17 18 19 20 21  15 16 17 18 19 20 21 
> -22 23 24 25 26 27 28  22 23 24 25 26 27 28  22 23 24 25 26 27 28 
> -29 30                 29 30 31              29 30 31

All months start at Sunday? Nice. 

It means that we had regression tests, but nobody reviewed that
the output from cal(1) in the tests makes any sense :-((((

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 07/10] mkfs.cramfs: fix unsigned integer overflow [AddressSanitizer]
  2014-11-30 13:57 ` [PATCH 07/10] mkfs.cramfs: fix unsigned integer overflow [AddressSanitizer] Sami Kerola
@ 2014-12-08 11:37   ` Karel Zak
  2014-12-19  9:24     ` Sami Kerola
  0 siblings, 1 reply; 34+ messages in thread
From: Karel Zak @ 2014-12-08 11:37 UTC (permalink / raw)
  To: Sami Kerola; +Cc: util-linux

On Sun, Nov 30, 2014 at 01:57:39PM +0000, Sami Kerola wrote:
> --- a/disk-utils/mkfs.cramfs.c
> +++ b/disk-utils/mkfs.cramfs.c
> @@ -619,7 +619,10 @@ do_compress(char *base, unsigned int offset, unsigned char const *name,
>  	/* TODO: Arguably, original_size in these 2 lines should be
>  	   st_blocks * 512.  But if you say that, then perhaps
>  	   administrative data should also be included in both. */
> -	change = new_size - original_size;
> +	if (new_size <= original_size)
> +		change = new_size - original_size;
> +	else
> +		change = new_size;

Is it correct?

>  	if (verbose)
>  		printf(_("%6.2f%% (%+ld bytes)\t%s\n"),
>  		       (change * 100) / (double) original_size, change, name);

The verbose message reports difference between old and new size (in
{+,-} bytes) Your patch use complete new_size if this number is bigger
that original_size.

    Karel


-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 03/10] more: fix unsigned integer overflow [AddressSanitizer]
  2014-11-30 13:57 ` [PATCH 03/10] more: fix unsigned " Sami Kerola
@ 2014-12-08 11:42   ` Karel Zak
  2014-12-08 12:56     ` Sami Kerola
  0 siblings, 1 reply; 34+ messages in thread
From: Karel Zak @ 2014-12-08 11:42 UTC (permalink / raw)
  To: Sami Kerola; +Cc: util-linux

On Sun, Nov 30, 2014 at 01:57:35PM +0000, Sami Kerola wrote:
> text-utils/more.c:1137:20: runtime error: unsigned integer overflow: 0 -
> 1 cannot be represented in type 'size_t' (aka 'unsigned long')
> text-utils/more.c:1139:7: runtime error: unsigned integer overflow: 2 +
> 18446744073709551615 cannot be represented in type 'unsigned long'
> 
> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
> ---
>  text-utils/more.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/text-utils/more.c b/text-utils/more.c
> index a489953..4b03e0d 100644
> --- a/text-utils/more.c
> +++ b/text-utils/more.c
> @@ -1125,14 +1125,14 @@ void prbuf(register char *s, register int n)
>  #ifdef HAVE_WIDECHAR
>  			{
>  				wchar_t wc;
> -				size_t mblength;
> +				ssize_t mblength;
>  				mbstate_t mbstate;
>  				memset(&mbstate, '\0', sizeof(mbstate_t));
>  				s--;
>  				n++;
>  				mblength = mbrtowc(&wc, s, n, &mbstate);
> -				if (mblength == (size_t)-2
> -				    || mblength == (size_t)-1)
> +				if (mblength == -2
> +				    || mblength == -1)

Really? (size_t) -1 and (size_t) -2 are by libc API defined return
codes. It would be better to keep it in code.

    Karel


-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 10/10] ipcs: fix two data type errors [AddressSanitizer]
  2014-11-30 13:57 ` [PATCH 10/10] ipcs: fix two data type errors [AddressSanitizer] Sami Kerola
@ 2014-12-08 12:21   ` Karel Zak
  2014-12-19  9:26     ` Sami Kerola
  0 siblings, 1 reply; 34+ messages in thread
From: Karel Zak @ 2014-12-08 12:21 UTC (permalink / raw)
  To: Sami Kerola; +Cc: util-linux

On Sun, Nov 30, 2014 at 01:57:42PM +0000, Sami Kerola wrote:
> ==3218==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fffa577e2b0 at pc 0x4501f9 bp 0x7fffa577e130 sp 0x7fffa577e108
> WRITE of size 112 at 0x7fffa577e2b0 thread T0
>     #0 0x4501f8 in shmctl /home/users/aadgrand/LLVM/releases/ubuntu/final/llvm.src/projects/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc:2502
>     #1 0x48bd13 in ipc_shm_get_info /home/travis/build/kerolasa/lelux-utiliteetit/sys-utils/ipcutils.c:157
>     #2 0x488884 in do_shm /home/travis/build/kerolasa/lelux-utiliteetit/sys-utils/ipcs.c:279
>     #3 0x4844a8 in main /home/travis/build/kerolasa/lelux-utiliteetit/sys-utils/ipcs.c:175
>     #4 0x2afb3f8c176c (/lib/x86_64-linux-gnu/libc.so.6+0x2176c)
>     #5 0x48408c in _start (/home/travis/build/kerolasa/lelux-utiliteetit/ipcs+0x48408c)
> 
> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
> ---
>  sys-utils/ipcutils.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/sys-utils/ipcutils.c b/sys-utils/ipcutils.c
> index c45162a..3d5249c 100644
> --- a/sys-utils/ipcutils.c
> +++ b/sys-utils/ipcutils.c
> @@ -98,7 +98,7 @@ int ipc_shm_get_info(int id, struct shm_data **shmds)
>  	FILE *f;
>  	int i = 0, maxid;
>  	struct shm_data *p;
> -	struct shm_info dummy;
> +	struct shmid_ds dummy;
>  
>  	p = *shmds = xcalloc(1, sizeof(struct shm_data));
>  	p->next = NULL;
> @@ -154,7 +154,7 @@ int ipc_shm_get_info(int id, struct shm_data **shmds)
>  
>  	/* Fallback; /proc or /sys file(s) missing. */
>  shm_fallback:
> -	maxid = shmctl(0, SHM_INFO, (struct shmid_ds *) &dummy);
> +	maxid = shmctl(0, SHM_INFO, &dummy);

 ipc_shm_get_limits() is also broken

 The function shmctl() has to be always called with "struct shmid_ds"
 and then cast to linux specific shmid_info struct.

 It would be nice to check that all the shm/sem/msgctl functions are
 really called with proper arguments.

 (Or we can define any union and use it as buffer to make sure that
  the argument is large enough.)

 BTW, horrible API (or I need more coffee to understand this art).


    Karel
 

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 03/10] more: fix unsigned integer overflow [AddressSanitizer]
  2014-12-08 11:42   ` Karel Zak
@ 2014-12-08 12:56     ` Sami Kerola
  2014-12-19  9:20       ` Sami Kerola
  0 siblings, 1 reply; 34+ messages in thread
From: Sami Kerola @ 2014-12-08 12:56 UTC (permalink / raw)
  To: Karel Zak; +Cc: util-linux

On 8 December 2014 at 11:42, Karel Zak <kzak@redhat.com> wrote:
> On Sun, Nov 30, 2014 at 01:57:35PM +0000, Sami Kerola wrote:
>> text-utils/more.c:1137:20: runtime error: unsigned integer overflow: 0 -
>> 1 cannot be represented in type 'size_t' (aka 'unsigned long')
>> text-utils/more.c:1139:7: runtime error: unsigned integer overflow: 2 +
>> 18446744073709551615 cannot be represented in type 'unsigned long'
>>
>> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
>> ---
>>  text-utils/more.c | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/text-utils/more.c b/text-utils/more.c
>> index a489953..4b03e0d 100644
>> --- a/text-utils/more.c
>> +++ b/text-utils/more.c
>> @@ -1125,14 +1125,14 @@ void prbuf(register char *s, register int n)
>>  #ifdef HAVE_WIDECHAR
>>                       {
>>                               wchar_t wc;
>> -                             size_t mblength;
>> +                             ssize_t mblength;
>>                               mbstate_t mbstate;
>>                               memset(&mbstate, '\0', sizeof(mbstate_t));
>>                               s--;
>>                               n++;
>>                               mblength = mbrtowc(&wc, s, n, &mbstate);
>> -                             if (mblength == (size_t)-2
>> -                                 || mblength == (size_t)-1)
>> +                             if (mblength == -2
>> +                                 || mblength == -1)
>
> Really? (size_t) -1 and (size_t) -2 are by libc API defined return
> codes. It would be better to keep it in code.

In that case moving the mbrtowc() to a small function that is ASAN
blacklisted sounds like a right thing to do.

-- 
Sami Kerola
http://www.iki.fi/kerolasa/

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 00/10] pull: AddressSanitizer round II
  2014-11-30 13:57 [PATCH 00/10] pull: AddressSanitizer round II Sami Kerola
                   ` (10 preceding siblings ...)
  2014-11-30 14:03 ` [PATCH 00/10] pull: AddressSanitizer round II Sami Kerola
@ 2014-12-15  9:15 ` Karel Zak
  2014-12-15 10:38   ` Sami Kerola
  2014-12-19 13:23 ` Karel Zak
  12 siblings, 1 reply; 34+ messages in thread
From: Karel Zak @ 2014-12-15  9:15 UTC (permalink / raw)
  To: Sami Kerola; +Cc: util-linux

On Sun, Nov 30, 2014 at 01:57:32PM +0000, Sami Kerola wrote:
> Here comes the second set of changes to enable AddressSanitizer one day
> in future.  These changed does not include update to travis-functions, as
> demonstrated below, due reason explained later.  The environment changes
> in the diff are useful for other who want to try ASAN compilations.

Hi Sami, do you plan to update these patches? I'd like to release -rc1
this month :-)

    Karel


-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 00/10] pull: AddressSanitizer round II
  2014-12-15  9:15 ` Karel Zak
@ 2014-12-15 10:38   ` Sami Kerola
  2014-12-19  9:52     ` Sami Kerola
  0 siblings, 1 reply; 34+ messages in thread
From: Sami Kerola @ 2014-12-15 10:38 UTC (permalink / raw)
  To: Karel Zak; +Cc: util-linux

On 15 December 2014 at 09:15, Karel Zak <kzak@redhat.com> wrote:
> On Sun, Nov 30, 2014 at 01:57:32PM +0000, Sami Kerola wrote:
>> Here comes the second set of changes to enable AddressSanitizer one day
>> in future.  These changed does not include update to travis-functions, as
>> demonstrated below, due reason explained later.  The environment changes
>> in the diff are useful for other who want to try ASAN compilations.
>
> Hi Sami, do you plan to update these patches? I'd like to release -rc1
> this month :-)

Hi Karel,

Sorry, I have been a bit lazy with ASAN patch series. I'll try to do
the required small fixes in beginning part of the week, and send
replies what was changed.

BTW nice to know we are getting closer to a release.

-- 
Sami Kerola
http://www.iki.fi/kerolasa/

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 03/10] more: fix unsigned integer overflow [AddressSanitizer]
  2014-12-08 12:56     ` Sami Kerola
@ 2014-12-19  9:20       ` Sami Kerola
  0 siblings, 0 replies; 34+ messages in thread
From: Sami Kerola @ 2014-12-19  9:20 UTC (permalink / raw)
  To: kerolasa; +Cc: Karel Zak, util-linux

On Mon, 8 Dec 2014, Sami Kerola wrote:

> On 8 December 2014 at 11:42, Karel Zak <kzak@redhat.com> wrote:
>> On Sun, Nov 30, 2014 at 01:57:35PM +0000, Sami Kerola wrote:
>>> text-utils/more.c:1137:20: runtime error: unsigned integer overflow: 0 -
>>> 1 cannot be represented in type 'size_t' (aka 'unsigned long')
>>> text-utils/more.c:1139:7: runtime error: unsigned integer overflow: 2 +
>>> 18446744073709551615 cannot be represented in type 'unsigned long'
>>>
>>> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
>>> ---
>>>  text-utils/more.c | 6 +++---
>>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/text-utils/more.c b/text-utils/more.c
>>> index a489953..4b03e0d 100644
>>> --- a/text-utils/more.c
>>> +++ b/text-utils/more.c
>>> @@ -1125,14 +1125,14 @@ void prbuf(register char *s, register int n)
>>>  #ifdef HAVE_WIDECHAR
>>>                       {
>>>                               wchar_t wc;
>>> -                             size_t mblength;
>>> +                             ssize_t mblength;
>>>                               mbstate_t mbstate;
>>>                               memset(&mbstate, '\0', sizeof(mbstate_t));
>>>                               s--;
>>>                               n++;
>>>                               mblength = mbrtowc(&wc, s, n, &mbstate);
>>> -                             if (mblength == (size_t)-2
>>> -                                 || mblength == (size_t)-1)
>>> +                             if (mblength == -2
>>> +                                 || mblength == -1)
>>
>> Really? (size_t) -1 and (size_t) -2 are by libc API defined return
>> codes. It would be better to keep it in code.
>
> In that case moving the mbrtowc() to a small function that is ASAN
> blacklisted sounds like a right thing to do.

Old more(1) change is replaced with

https://github.com/kerolasa/lelux-utiliteetit/commit/e8e72e378a29072781cd4de250570ae07ad88477

Here is the change for review purpose. Karel, I think it is easier to get 
these changes from my github than from mail list, but of course it's your.

--->8----
From: Sami Kerola <kerolasa@iki.fi>
Date: Wed, 17 Dec 2014 22:57:02 +0000
Subject: [PATCH 10/10] more: blacklist unsigned integer overflow [AddressSanitizer]

The mbrtowc() return values are overflowing by design.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
  text-utils/more.c | 15 +++++++++++----
  1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/text-utils/more.c b/text-utils/more.c
index 8c0853c..a75cd7a 100644
--- a/text-utils/more.c
+++ b/text-utils/more.c
@@ -1091,6 +1091,16 @@ void clreos(void)
  	my_putstring(EodClr);
  }

+
+static UL_ASAN_BLACKLIST xmbrtowc(wchar_t *wc, const char *s, size_t n,
+				  mbstate_t *mbstate)
+{
+	const size_t mblength = mbrtowc(&wc, s, n, &mbstate);
+	if (mblength == (size_t)-2 || mblength == (size_t)-1)
+		return 1;
+	return mblength;
+}
+
  /* Print a buffer of n characters */
  void prbuf(register char *s, register int n)
  {
@@ -1130,10 +1140,7 @@ void prbuf(register char *s, register int n)
  				memset(&mbstate, '\0', sizeof(mbstate_t));
  				s--;
  				n++;
-				mblength = mbrtowc(&wc, s, n, &mbstate);
-				if (mblength == (size_t)-2
-				    || mblength == (size_t)-1)
-					mblength = 1;
+				mblength = xmbrtowc(&wc, s, n, &mbstate);
  				while (mblength--)
  					putchar(*s++);
  				n += mblength;
-- 
2.2.0


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* Re: [PATCH 07/10] mkfs.cramfs: fix unsigned integer overflow [AddressSanitizer]
  2014-12-08 11:37   ` Karel Zak
@ 2014-12-19  9:24     ` Sami Kerola
  0 siblings, 0 replies; 34+ messages in thread
From: Sami Kerola @ 2014-12-19  9:24 UTC (permalink / raw)
  To: Karel Zak; +Cc: util-linux

On Mon, 8 Dec 2014, Karel Zak wrote:

> On Sun, Nov 30, 2014 at 01:57:39PM +0000, Sami Kerola wrote:
>> --- a/disk-utils/mkfs.cramfs.c
>> +++ b/disk-utils/mkfs.cramfs.c
>> @@ -619,7 +619,10 @@ do_compress(char *base, unsigned int offset, unsigned char const *name,
>>  	/* TODO: Arguably, original_size in these 2 lines should be
>>  	   st_blocks * 512.  But if you say that, then perhaps
>>  	   administrative data should also be included in both. */
>> -	change = new_size - original_size;
>> +	if (new_size <= original_size)
>> +		change = new_size - original_size;
>> +	else
>> +		change = new_size;
>
> Is it correct?
>
>>  	if (verbose)
>>  		printf(_("%6.2f%% (%+ld bytes)\t%s\n"),
>>  		       (change * 100) / (double) original_size, change, name);
>
> The verbose message reports difference between old and new size (in
> {+,-} bytes) Your patch use complete new_size if this number is bigger
> that original_size.

I think the size should be bigger. The following is added to the commit 
message.

-- snip
The original_size should be in 512 bytes blocks but it isn't while the 
new_size is using 512 bytes blocks.  When original_size size is smaller 
then 512 the new_size grows rather than shrinks, what one usually would 
expect after data compression.  See also TODO comment near the change.
-- snip

Karel, if in doubt drop this patch and I'll try come up with something by 
the time of asan3 series (not any time soon, first we need travis to 
update clang).

-- 
Sami Kerola
http://www.iki.fi/kerolasa/

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 10/10] ipcs: fix two data type errors [AddressSanitizer]
  2014-12-08 12:21   ` Karel Zak
@ 2014-12-19  9:26     ` Sami Kerola
  0 siblings, 0 replies; 34+ messages in thread
From: Sami Kerola @ 2014-12-19  9:26 UTC (permalink / raw)
  To: Karel Zak; +Cc: util-linux

On Mon, 8 Dec 2014, Karel Zak wrote:

> ipc_shm_get_limits() is also broken
>
> The function shmctl() has to be always called with "struct shmid_ds"
> and then cast to linux specific shmid_info struct.
>
> It would be nice to check that all the shm/sem/msgctl functions are
> really called with proper arguments.
>
> (Or we can define any union and use it as buffer to make sure that
>  the argument is large enough.)

How about doing further corrections later?

> BTW, horrible API (or I need more coffee to understand this art).

Mostly because of I share the view above. Getting ipc api usage right is 
not quite as easy task as one might hope.

-- 
Sami Kerola
http://www.iki.fi/kerolasa/

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 08/10] include/c: define UL_ASAN_BLACKLIST address_sanitizer function attribute
  2014-11-30 16:42   ` Benno Schulenberg
@ 2014-12-19  9:50     ` Sami Kerola
  0 siblings, 0 replies; 34+ messages in thread
From: Sami Kerola @ 2014-12-19  9:50 UTC (permalink / raw)
  To: Benno Schulenberg; +Cc: Util-Linux

On Sun, 30 Nov 2014, Benno Schulenberg wrote:

> On Sun, Nov 30, 2014, at 14:57, Sami Kerola wrote:
>> The UL_ASAN_BLACKLIST allows AddressSanitizer to be set off for functions
>> that cannot be checked.
>
> s/set/switched/

Thanks Benno.

Fixed in

https://github.com/kerolasa/lelux-utiliteetit/commit/03caf13f09b1224aa7bd296ed223785b61ca4c7e

> (Because "set off" means "triggered", which means "run" -- but
> the intention is to say "not run".)
>
>> + *   Furthermore, it will prevent the compiler from
>> + * inlining the function because inlining currently breaks the blacklisting
>> + * mechanism of AddressSanitizer.
>
> Ow...  Could uninlining something in some rare cases not break
> the function of that something?

We shall see? I don't have anything better to offer as a fix to a concern.

-- 
Sami Kerola
http://www.iki.fi/kerolasa/

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 00/10] pull: AddressSanitizer round II
  2014-12-15 10:38   ` Sami Kerola
@ 2014-12-19  9:52     ` Sami Kerola
  0 siblings, 0 replies; 34+ messages in thread
From: Sami Kerola @ 2014-12-19  9:52 UTC (permalink / raw)
  To: util-linux; +Cc: Karel Zak

On Mon, 15 Dec 2014, Sami Kerola wrote:

> On 15 December 2014 at 09:15, Karel Zak <kzak@redhat.com> wrote:
>> On Sun, Nov 30, 2014 at 01:57:32PM +0000, Sami Kerola wrote:
>>> Here comes the second set of changes to enable AddressSanitizer one day
>>> in future.  These changed does not include update to travis-functions, as
>>> demonstrated below, due reason explained later.  The environment changes
>>> in the diff are useful for other who want to try ASAN compilations.
>>
>> Hi Sami, do you plan to update these patches? I'd like to release -rc1
>> this month :-)
>
> Hi Karel,
>
> Sorry, I have been a bit lazy with ASAN patch series. I'll try to do
> the required small fixes in beginning part of the week, and send
> replies what was changed.

Hi Karel and others,

I think I replied to all feedback. Please inform if I missed something. 
And especially if after the new updates the changes are still wrong, 
incomplete, broken, ...

-- 
Sami Kerola
http://www.iki.fi/kerolasa/

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 00/10] pull: AddressSanitizer round II
  2014-11-30 13:57 [PATCH 00/10] pull: AddressSanitizer round II Sami Kerola
                   ` (11 preceding siblings ...)
  2014-12-15  9:15 ` Karel Zak
@ 2014-12-19 13:23 ` Karel Zak
  12 siblings, 0 replies; 34+ messages in thread
From: Karel Zak @ 2014-12-19 13:23 UTC (permalink / raw)
  To: Sami Kerola; +Cc: util-linux

On Sun, Nov 30, 2014 at 01:57:32PM +0000, Sami Kerola wrote:
> Sami Kerola (10):
>   lib/mbalign: fix unsigned integer overflow [AddressSanitizer]
>   cal: fix signed integer overflow [AddressSanitizer]
>   more: fix unsigned integer overflow [AddressSanitizer]
>   lib: fix crc32 and crc64 interger overflows [AddressSanitizer]
>   fdisk: (sgi) fix unsigned integer overflow [AddressSanitizer]
>   strutils: fix unsigned integer overflows [AddressSanitizer]
>   mkfs.cramfs: fix unsigned integer overflow [AddressSanitizer]
>   include/c: define UL_ASAN_BLACKLIST address_sanitizer function
>     attribute
>   lscpu: blacklist vmware_bdoor() AddressSanitizer check
>   ipcs: fix two data type errors [AddressSanitizer]

All merged from github, but except the mkfs.cramfs patch. I have also
fixed the issues with struct shm_info in ipc*.c.

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2014-12-19 13:23 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-30 13:57 [PATCH 00/10] pull: AddressSanitizer round II Sami Kerola
2014-11-30 13:57 ` [PATCH 01/10] lib/mbalign: fix unsigned integer overflow [AddressSanitizer] Sami Kerola
2014-12-03 23:53   ` Pádraig Brady
2014-12-04 20:14     ` Sami Kerola
2014-12-07 11:56       ` Pádraig Brady
2014-12-08 11:00         ` Karel Zak
2014-12-04 11:51   ` Pádraig Brady
2014-11-30 13:57 ` [PATCH 02/10] cal: fix signed " Sami Kerola
2014-12-08 11:07   ` Karel Zak
2014-11-30 13:57 ` [PATCH 03/10] more: fix unsigned " Sami Kerola
2014-12-08 11:42   ` Karel Zak
2014-12-08 12:56     ` Sami Kerola
2014-12-19  9:20       ` Sami Kerola
2014-11-30 13:57 ` [PATCH 04/10] lib: fix crc32 and crc64 interger overflows [AddressSanitizer] Sami Kerola
2014-11-30 13:57 ` [PATCH 05/10] fdisk: (sgi) fix unsigned integer overflow [AddressSanitizer] Sami Kerola
2014-11-30 13:57 ` [PATCH 06/10] strutils: fix unsigned integer overflows [AddressSanitizer] Sami Kerola
2014-11-30 13:57 ` [PATCH 07/10] mkfs.cramfs: fix unsigned integer overflow [AddressSanitizer] Sami Kerola
2014-12-08 11:37   ` Karel Zak
2014-12-19  9:24     ` Sami Kerola
2014-11-30 13:57 ` [PATCH 08/10] include/c: define UL_ASAN_BLACKLIST address_sanitizer function attribute Sami Kerola
2014-11-30 16:42   ` Benno Schulenberg
2014-12-19  9:50     ` Sami Kerola
2014-11-30 13:57 ` [PATCH 09/10] lscpu: blacklist vmware_bdoor() AddressSanitizer check Sami Kerola
2014-11-30 16:34   ` Benno Schulenberg
2014-11-30 17:17     ` Sami Kerola
2014-11-30 17:27     ` Drake Wilson
2014-11-30 13:57 ` [PATCH 10/10] ipcs: fix two data type errors [AddressSanitizer] Sami Kerola
2014-12-08 12:21   ` Karel Zak
2014-12-19  9:26     ` Sami Kerola
2014-11-30 14:03 ` [PATCH 00/10] pull: AddressSanitizer round II Sami Kerola
2014-12-15  9:15 ` Karel Zak
2014-12-15 10:38   ` Sami Kerola
2014-12-19  9:52     ` Sami Kerola
2014-12-19 13:23 ` Karel Zak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).