summaryrefslogtreecommitdiff
path: root/support/regression/tests/bug-3117729.c
blob: 1ee084e141cb15fd313d059c44d2996782c594b1 (plain)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
	Bug 3117729
 	For
 	x = x + state[i] + pKey[mod_16x8(i, iKeyLen)];
 	an invalid
 	add	a,(#_x + 0)
 	was generated.
 */


#include <testfwk.h>

#define UCHAR	unsigned char
#define USHORT	unsigned short

#define PCHAR	unsigned char *

#pragma disable_warning 85

UCHAR mod_16x8(USHORT s16, UCHAR i8)
{
	return (0);
}

#if !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) // Lack of memory
__xdata UCHAR state[256];
UCHAR x, y;

void swap(PCHAR pa, PCHAR pb)
{
}

void RC4Init(PCHAR pKey, UCHAR iKeyLen)
{
	UCHAR i;

	i = 0;
	do
	{
		state[i] = i;
		i ++;
	} while (i);

	x = 0;
	do
	{
		x = x + state[i] + pKey[mod_16x8(i, iKeyLen)];
		swap(&state[i], &state[x]);
		i ++;
	} while(i);
	x = 0;
	y = 0;
}
#endif

void
testBug(void)
{
	ASSERT(1);
}