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 @@ -320,16 +320,23 @@ impl Descriptor {
320
320
return Err ( InvalidIoMap :: TooLong { len : iomap. len ( ) } )
321
321
}
322
322
323
- let distance = iomap. as_ptr ( ) as usize - tss as * const _ as usize ;
324
- if distance > 0xdfff {
325
- return Err ( InvalidIoMap :: TooFarFromTss { distance } )
323
+ let base = iomap. as_ptr ( ) as usize - tss as * const _ as usize ;
324
+ if base > 0xdfff {
325
+ return Err ( InvalidIoMap :: TooFarFromTss { distance : base } )
326
326
}
327
327
328
328
let last_byte = * iomap. last ( ) . unwrap_or ( & 0xff ) ;
329
329
if last_byte != 0xff {
330
330
return Err ( InvalidIoMap :: InvalidTerminatingByte { byte : last_byte } )
331
331
}
332
332
333
+ if tss. iomap_base != base as u16 {
334
+ return Err ( InvalidIoMap :: InvalidBase {
335
+ expected : base as u16 ,
336
+ got : tss. iomap_base
337
+ } ) ;
338
+ }
339
+
333
340
// SAFETY: all invariants checked above
334
341
Ok ( unsafe { Self :: tss_segment_raw ( tss, iomap. len ( ) as u16 ) } )
335
342
}
Original file line number Diff line number Diff line change @@ -55,4 +55,9 @@ pub enum InvalidIoMap {
55
55
TooLong {
56
56
len : usize
57
57
} ,
58
+ /// The `iomap_base` in the `TaskStateSegment` struct was not what was expected.
59
+ InvalidBase {
60
+ expected : u16 ,
61
+ got : u16 ,
62
+ }
58
63
}
You can’t perform that action at this time.
0 commit comments