File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
branches/stable/src/libstd/sys/windows Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ refs/heads/tmp: afae2ff723393b3ab4ccffef6ac7c6d1809e2da0
29
29
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
30
30
refs/tags/homu-tmp: f859507de8c410b648d934d8f5ec1c52daac971d
31
31
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32
- refs/heads/stable: b107af3ada920f6902ee4cbed08858013ea60177
32
+ refs/heads/stable: 2148567821b0e3ff63e13b652b9b645263b70cb0
33
33
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
34
34
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
35
35
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e
Original file line number Diff line number Diff line change @@ -311,7 +311,8 @@ impl ExactSizeIterator for Args {
311
311
312
312
impl Drop for Args {
313
313
fn drop ( & mut self ) {
314
- // NULL-safe
314
+ // self.cur can be null if CommandLineToArgvW previously failed,
315
+ // but LocalFree ignores NULL pointers
315
316
unsafe { c:: LocalFree ( self . cur as * mut c_void ) ; }
316
317
}
317
318
}
@@ -322,8 +323,9 @@ pub fn args() -> Args {
322
323
let lpCmdLine = c:: GetCommandLineW ( ) ;
323
324
let szArgList = c:: CommandLineToArgvW ( lpCmdLine, & mut nArgs) ;
324
325
325
- // cur may be NULL if CommandLineToArgvW failed,
326
- // in which case the range is empty to prevent reads
326
+ // szArcList can be NULL if CommandLinToArgvW failed,
327
+ // but in that case nArgs is 0 so we won't actually
328
+ // try to read a null pointer
327
329
Args { cur : szArgList, range : 0 ..( nArgs as isize ) }
328
330
}
329
331
}
You can’t perform that action at this time.
0 commit comments