SFbugfix - "an integer overflow BUG of Bochs-2.3.7 source code"

This commit is contained in:
Stanislav Shwartsman 2009-04-30 07:30:13 +00:00
parent 12f536fae9
commit 4c06bb8657

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: harddrv.cc,v 1.227 2009-04-25 08:06:32 vruppert Exp $
// $Id: harddrv.cc,v 1.228 2009-04-30 07:30:13 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -173,7 +173,7 @@ void bx_hard_drive_c::init(void)
char ata_name[20];
bx_list_c *base;
BX_DEBUG(("Init $Id: harddrv.cc,v 1.227 2009-04-25 08:06:32 vruppert Exp $"));
BX_DEBUG(("Init $Id: harddrv.cc,v 1.228 2009-04-30 07:30:13 sshwarts Exp $"));
for (channel=0; channel<BX_MAX_ATA_CHANNEL; channel++) {
sprintf(ata_name, "ata.%d.resources", channel);
@ -427,7 +427,7 @@ void bx_hard_drive_c::init(void)
disk_size = BX_HD_THIS channels[channel].drives[device].hard_drive->hd_size;
if (image_mode != BX_ATA_MODE_VMWARE3 && image_mode != BX_ATA_MODE_VMWARE4) {
cyl = (int)(disk_size / (heads * spt * 512));
if (disk_size != (Bit64u)(cyl * heads * spt * 512)) {
if (disk_size != ((Bit64u)cyl * heads * spt * 512)) {
BX_PANIC(("ata%d-%d: geometry autodetection failed", channel, device));
}
BX_HD_THIS channels[channel].drives[device].hard_drive->cylinders = cyl;