1
Index: qemu-0.9.1/block.c
2
===================================================================
3
--- qemu-0.9.1.orig/block.c 2008-04-14 11:26:13.000000000 +0200
4
+++ qemu-0.9.1/block.c 2008-04-14 11:26:14.000000000 +0200
11
if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) {
12
memcpy(bs->boot_sector_data, buf, 512);
14
if (drv->bdrv_pwrite) {
18
len = nb_sectors * 512;
19
- ret = drv->bdrv_pwrite(bs, sector_num * 512, buf, len);
20
+ ns = sector_num * 512;
24
+ ret = drv->bdrv_pwrite(bs, ns, buf, len);
28
Index: qemu-0.9.1/hw/cirrus_vga.c
29
===================================================================
30
--- qemu-0.9.1.orig/hw/cirrus_vga.c 2008-04-14 11:26:14.000000000 +0200
31
+++ qemu-0.9.1/hw/cirrus_vga.c 2008-04-14 11:26:15.000000000 +0200
33
#define CIRRUS_HOOK_NOT_HANDLED 0
34
#define CIRRUS_HOOK_HANDLED 1
36
+#define BLTUNSAFE(s) \
38
+ ( /* check dst is within bounds */ \
39
+ (s)->cirrus_blt_height * (s)->cirrus_blt_dstpitch \
40
+ + ((s)->cirrus_blt_dstaddr & (s)->cirrus_addr_mask) > \
43
+ ( /* check src is within bounds */ \
44
+ (s)->cirrus_blt_height * (s)->cirrus_blt_srcpitch \
45
+ + ((s)->cirrus_blt_srcaddr & (s)->cirrus_addr_mask) > \
50
struct CirrusVGAState;
51
typedef void (*cirrus_bitblt_rop_t) (struct CirrusVGAState *s,
52
uint8_t * dst, const uint8_t * src,
55
for (y = 0; y < lines; y++) {
57
- off_cur_end = off_cur + bytesperline;
58
+ off_cur_end = (off_cur + bytesperline) & s->cirrus_addr_mask;
59
off_cur &= TARGET_PAGE_MASK;
60
while (off_cur < off_cur_end) {
61
cpu_physical_memory_set_dirty(s->vram_offset + off_cur);
66
- dst = s->vram_ptr + s->cirrus_blt_dstaddr;
67
+ dst = s->vram_ptr + (s->cirrus_blt_dstaddr & s->cirrus_addr_mask);
72
(*s->cirrus_rop) (s, dst, src,
73
s->cirrus_blt_dstpitch, 0,
74
s->cirrus_blt_width, s->cirrus_blt_height);
77
cirrus_fill_t rop_func;
81
rop_func = cirrus_fill[rop_to_index[blt_rop]][s->cirrus_blt_pixelwidth - 1];
82
- rop_func(s, s->vram_ptr + s->cirrus_blt_dstaddr,
83
+ rop_func(s, s->vram_ptr + (s->cirrus_blt_dstaddr & s->cirrus_addr_mask),
84
s->cirrus_blt_dstpitch,
85
s->cirrus_blt_width, s->cirrus_blt_height);
86
cirrus_invalidate_region(s, s->cirrus_blt_dstaddr,
88
static int cirrus_bitblt_videotovideo_patterncopy(CirrusVGAState * s)
90
return cirrus_bitblt_common_patterncopy(s,
92
- (s->cirrus_blt_srcaddr & ~7));
93
+ s->vram_ptr + ((s->cirrus_blt_srcaddr & ~7) &
94
+ s->cirrus_addr_mask));
97
static void cirrus_do_copy(CirrusVGAState *s, int dst, int src, int w, int h)
102
- (*s->cirrus_rop) (s, s->vram_ptr + s->cirrus_blt_dstaddr,
103
- s->vram_ptr + s->cirrus_blt_srcaddr,
104
+ (*s->cirrus_rop) (s, s->vram_ptr +
105
+ (s->cirrus_blt_dstaddr & s->cirrus_addr_mask),
107
+ (s->cirrus_blt_srcaddr & s->cirrus_addr_mask),
108
s->cirrus_blt_dstpitch, s->cirrus_blt_srcpitch,
109
s->cirrus_blt_width, s->cirrus_blt_height);
112
s->cirrus_blt_srcaddr - s->start_addr,
113
s->cirrus_blt_width, s->cirrus_blt_height);
115
- (*s->cirrus_rop) (s, s->vram_ptr + s->cirrus_blt_dstaddr,
116
- s->vram_ptr + s->cirrus_blt_srcaddr,
121
+ (*s->cirrus_rop) (s, s->vram_ptr +
122
+ (s->cirrus_blt_dstaddr & s->cirrus_addr_mask),
124
+ (s->cirrus_blt_srcaddr & s->cirrus_addr_mask),
125
s->cirrus_blt_dstpitch, s->cirrus_blt_srcpitch,
126
s->cirrus_blt_width, s->cirrus_blt_height);
130
/* at least one scan line */
132
- (*s->cirrus_rop)(s, s->vram_ptr + s->cirrus_blt_dstaddr,
133
- s->cirrus_bltbuf, 0, 0, s->cirrus_blt_width, 1);
134
+ (*s->cirrus_rop)(s, s->vram_ptr +
135
+ (s->cirrus_blt_dstaddr & s->cirrus_addr_mask),
136
+ s->cirrus_bltbuf, 0, 0, s->cirrus_blt_width, 1);
137
cirrus_invalidate_region(s, s->cirrus_blt_dstaddr, 0,
138
s->cirrus_blt_width, 1);
139
s->cirrus_blt_dstaddr += s->cirrus_blt_dstpitch;
140
@@ -1920,7 +1949,7 @@
141
unsigned val = mem_value;
144
- dst = s->vram_ptr + offset;
145
+ dst = s->vram_ptr + (offset &= s->cirrus_addr_mask);
146
for (x = 0; x < 8; x++) {
148
*dst = s->cirrus_shadow_gr1;
149
@@ -1943,7 +1972,7 @@
150
unsigned val = mem_value;
153
- dst = s->vram_ptr + offset;
154
+ dst = s->vram_ptr + (offset &= s->cirrus_addr_mask);
155
for (x = 0; x < 8; x++) {
157
*dst = s->cirrus_shadow_gr1;
158
Index: qemu-0.9.1/hw/cirrus_vga_rop.h
159
===================================================================
160
--- qemu-0.9.1.orig/hw/cirrus_vga_rop.h 2008-01-06 20:38:42.000000000 +0100
161
+++ qemu-0.9.1/hw/cirrus_vga_rop.h 2008-04-14 11:26:15.000000000 +0200
164
dstpitch -= bltwidth;
165
srcpitch -= bltwidth;
167
+ if (dstpitch < 0 || srcpitch < 0) {
168
+ /* is 0 valid? srcpitch == 0 could be useful */
172
for (y = 0; y < bltheight; y++) {
173
for (x = 0; x < bltwidth; x++) {
175
Index: qemu-0.9.1/hw/dma.c
176
===================================================================
177
--- qemu-0.9.1.orig/hw/dma.c 2008-01-06 20:38:42.000000000 +0100
178
+++ qemu-0.9.1/hw/dma.c 2008-04-14 11:26:15.000000000 +0200
182
r = dma_controllers[ncont].regs + ichan;
183
- n = r->transfer_handler (r->opaque, ichan + (ncont << 2),
184
- r->now[COUNT], (r->base[COUNT] + 1) << ncont);
186
+ if (r->transfer_handler) {
187
+ n = r->transfer_handler (r->opaque, ichan + (ncont << 2),
188
+ r->now[COUNT], (r->base[COUNT] + 1) << ncont);
191
ldebug ("dma_pos %d size %d\n", n, (r->base[COUNT] + 1) << ncont);
194
Index: qemu-0.9.1/hw/fdc.c
195
===================================================================
196
--- qemu-0.9.1.orig/hw/fdc.c 2008-01-06 20:38:42.000000000 +0100
197
+++ qemu-0.9.1/hw/fdc.c 2008-04-14 11:26:15.000000000 +0200
198
@@ -1247,7 +1247,13 @@
199
len = fdctrl->data_len - fdctrl->data_pos;
200
if (len > FD_SECTOR_LEN)
202
- bdrv_read(cur_drv->bs, fd_sector(cur_drv), fdctrl->fifo, 1);
204
+ bdrv_read(cur_drv->bs, fd_sector(cur_drv),
207
+ FLOPPY_ERROR("can't read data from drive\n");
212
retval = fdctrl->fifo[pos];
213
Index: qemu-0.9.1/hw/pc.c
214
===================================================================
215
--- qemu-0.9.1.orig/hw/pc.c 2008-04-14 11:26:14.000000000 +0200
216
+++ qemu-0.9.1/hw/pc.c 2008-04-14 11:26:15.000000000 +0200
220
fprintf(stderr, "BIOS panic at rombios.c, line %d\n", val);
222
+ /* according to documentation, these can be safely ignored */
228
/* LGPL'ed VGA BIOS messages */
231
+ /* according to documentation, these can be safely ignored */
232
fprintf(stderr, "VGA BIOS panic, line %d\n", val);
238
Index: qemu-0.9.1/hw/sb16.c
239
===================================================================
240
--- qemu-0.9.1.orig/hw/sb16.c 2008-01-06 20:38:42.000000000 +0100
241
+++ qemu-0.9.1/hw/sb16.c 2008-04-14 11:26:15.000000000 +0200
242
@@ -1240,8 +1240,10 @@
246
- while (s->left_till_irq <= 0) {
247
- s->left_till_irq = s->block_size + s->left_till_irq;
248
+ if (s->block_size) {
249
+ while (s->left_till_irq <= 0) {
250
+ s->left_till_irq = s->block_size + s->left_till_irq;
255
Index: qemu-0.9.1/slirp/slirp.c
256
===================================================================
257
--- qemu-0.9.1.orig/slirp/slirp.c 2008-01-06 20:38:44.000000000 +0100
258
+++ qemu-0.9.1/slirp/slirp.c 2008-04-14 11:26:15.000000000 +0200
262
/* Note: we add to align the IP header */
263
+ /* taviso: large values in ne2k TCNT register may exceed msize on transmit */
264
+ if (M_FREEROOM(m) < pkt_len + 2) {
265
+ m_inc(m, pkt_len + 2);
267
m->m_len = pkt_len + 2;
268
memcpy(m->m_data + 2, pkt, pkt_len);
270
Index: qemu-0.9.1/target-i386/translate.c
271
===================================================================
272
--- qemu-0.9.1.orig/target-i386/translate.c 2008-01-06 20:38:45.000000000 +0100
273
+++ qemu-0.9.1/target-i386/translate.c 2008-04-14 11:26:15.000000000 +0200
274
@@ -5510,6 +5510,7 @@
275
gen_jmp_im(pc_start - s->cs_base);
276
gen_op_into(s->pc - pc_start);
279
case 0xf1: /* icebp (undocumented, exits to external debugger) */
280
if (gen_svm_check_intercept(s, pc_start, SVM_EXIT_ICEBP))
282
@@ -5521,6 +5522,7 @@
283
cpu_set_log(CPU_LOG_INT | CPU_LOG_TB_IN_ASM);
289
if (s->cpl <= s->iopl) {
290
Index: qemu-0.9.1/vl.c
291
===================================================================
292
--- qemu-0.9.1.orig/vl.c 2008-04-14 11:26:14.000000000 +0200
293
+++ qemu-0.9.1/vl.c 2008-04-14 11:26:54.000000000 +0200
294
@@ -4198,8 +4198,8 @@
297
int state; /* 0 = getting length, 1 = getting data */
300
+ unsigned int index;
301
+ unsigned int packet_len;
303
struct sockaddr_in dgram_dst; /* contains inet host and port destination iff connectionless (SOCK_DGRAM) */
305
@@ -4230,7 +4230,8 @@
306
static void net_socket_send(void *opaque)
308
NetSocketState *s = opaque;
315
@@ -4269,7 +4270,15 @@
316
l = s->packet_len - s->index;
319
- memcpy(s->buf + s->index, buf, l);
320
+ if (s->index + l <= sizeof(s->buf)) {
321
+ memcpy(s->buf + s->index, buf, l);
323
+ fprintf(stderr, "serious error: oversized packet received,"
324
+ "connection terminated.\n");