Mercurial > mplayer.hg
changeset 2552:bd734d41a407
Misc: more checks
author | nick |
---|---|
date | Tue, 30 Oct 2001 16:17:07 +0000 |
parents | 4c074b58b4b6 |
children | db0d4caf5e47 |
files | linux/vbelib.c |
diffstat | 1 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/linux/vbelib.c Tue Oct 30 16:16:49 2001 +0000 +++ b/linux/vbelib.c Tue Oct 30 16:17:07 2001 +0000 @@ -88,6 +88,7 @@ { unsigned short iopl_port; size_t i; + int retval; if(!LRMI_init()) return VBE_VM86_FAIL; /* Allow read/write to ALL io ports @@ -99,9 +100,11 @@ ioperm(0, 1024, 1); iopl(3); memset(&vbe_pm_info,0,sizeof(struct VesaProtModeInterface)); - vbeGetProtModeInfo(&vbe_pm_info); + retval = vbeGetProtModeInfo(&vbe_pm_info); + if(retval != VBE_OK) return retval; i = 0; - while((iopl_port=vbe_pm_info.iopl_ports[i++]) != 0xFFFF) ioperm(iopl_port,1,1); + while((iopl_port=vbe_pm_info.iopl_ports[i]) != 0xFFFF + && vbe_pm_info.iopl_ports[i++] > 1023) ioperm(iopl_port,1,1); iopl(3); return VBE_OK; } @@ -451,14 +454,17 @@ if((r.es >> 12) != hh_int_10_seg) retval = VBE_BROKEN_BIOS; rm_info = PhysToVirtSO(r.es,info_offset); pm_info->SetWindowCall = PhysToVirtSO(r.es,info_offset+rm_info->SetWindowCall); + if(!is_addr_valid(pm_info->SetWindowCall)) retval = VBE_BROKEN_BIOS; #ifdef HAVE_VERBOSE_VAR if(verbose > 1) printf("vbelib: SetWindowCall=%04X:%04X => %p\n",r.es,info_offset+rm_info->SetWindowCall,pm_info->SetWindowCall); #endif pm_info->SetDisplayStart = PhysToVirtSO(r.es,info_offset+rm_info->SetDisplayStart); + if(!is_addr_valid(pm_info->SetDisplayStart)) retval = VBE_BROKEN_BIOS; #ifdef HAVE_VERBOSE_VAR if(verbose > 1) printf("vbelib: SetDisplayStart=%04X:%04X => %p\n",r.es,info_offset+rm_info->SetDisplayStart,pm_info->SetDisplayStart); #endif pm_info->SetPaletteData = PhysToVirtSO(r.es,info_offset+rm_info->SetPaletteData); + if(!is_addr_valid(pm_info->SetPaletteData)) retval = VBE_BROKEN_BIOS; #ifdef HAVE_VERBOSE_VAR if(verbose > 1) printf("vbelib: SetPaletteData=%04X:%04X => %p\n",r.es,info_offset+rm_info->SetPaletteData,pm_info->SetPaletteData); #endif