Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [day] [month] [year] [list]
Date: Sun, 25 Mar 2018 21:17:47 +0200
From: Solar Designer <solar@...nwall.com>
To: john-dev@...ts.openwall.com
Subject: operator precedence in external mode

Hi magnum,

You'll want to merge my "Fixed operator precedence in the external mode
compiler to be the same as in C" commit from core into jumbo, and test
that the various external modes added in jumbo still work fine.  I've
tested those included in core, and they do.  The changes affect cases
that are subtle enough that I doubt any real external mode is affected.

Here's a test case that I use:

[List.External:prio]
void generate()
{
	int a, b;
	a = b = 0;
	word[0] = !++a + ~~!!b++ + 'a' + !1;
	word[1] = 'A' | 1 ^ 1;
	word[2] = 0;
}

$ ./john -ext=prio -stdo | head -1
Press 'q' or Ctrl-C to abort, almost any other key for status
aA

(The output was different prior to my commit.)

$ cat p.c
#include <stdio.h>

int main(void)
{
	char word[3];
	int a, b;
	a = b = 0;
	word[0] = !++a + ~~!!b++ + 'a' + !1;
	word[1] = 'A' | 1 ^ 1;
	word[2] = 0;
	puts(word);
	return 0;
}
$ gcc p.c -o p -Wall
p.c: In function 'main':
p.c:9:2: warning: suggest parentheses around arithmetic in operand of '|' [-Wparentheses]
$ ./p
aA

Alexander

Powered by blists - more mailing lists

Your e-mail address:

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.