File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -453,16 +453,23 @@ impl Descriptor {
453
453
return Err ( InvalidIoMap :: TooLong { len : iomap. len ( ) } )
454
454
}
455
455
456
- let distance = iomap. as_ptr ( ) as usize - tss as * const _ as usize ;
457
- if distance > 0xdfff {
458
- return Err ( InvalidIoMap :: TooFarFromTss { distance } )
456
+ let base = iomap. as_ptr ( ) as usize - tss as * const _ as usize ;
457
+ if base > 0xdfff {
458
+ return Err ( InvalidIoMap :: TooFarFromTss { distance : base } )
459
459
}
460
460
461
461
let last_byte = * iomap. last ( ) . unwrap_or ( & 0xff ) ;
462
462
if last_byte != 0xff {
463
463
return Err ( InvalidIoMap :: InvalidTerminatingByte { byte : last_byte } )
464
464
}
465
465
466
+ if tss. iomap_base != base as u16 {
467
+ return Err ( InvalidIoMap :: InvalidBase {
468
+ expected : base as u16 ,
469
+ got : tss. iomap_base
470
+ } ) ;
471
+ }
472
+
466
473
// SAFETY: all invariants checked above
467
474
Ok ( unsafe { Self :: tss_segment_raw ( tss, iomap. len ( ) as u16 ) } )
468
475
}
Original file line number Diff line number Diff line change @@ -68,6 +68,11 @@ pub enum InvalidIoMap {
68
68
TooLong {
69
69
len : usize
70
70
} ,
71
+ /// The `iomap_base` in the `TaskStateSegment` struct was not what was expected.
72
+ InvalidBase {
73
+ expected : u16 ,
74
+ got : u16 ,
75
+ }
71
76
}
72
77
73
78
#[ cfg( test) ]
You can’t perform that action at this time.
0 commit comments