1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* win32/win32.c (szInternalCmds, internal_match, internal_cmd_match):

get rid of a segmentation fault with GCC 4.7.0.
  reported by raylinn@gmail.com (ray linn) at [ruby-core:44505]
  [Bug #6333], and patched by mame.

* test/ruby/test_system.rb (TestSystem#test_system): test for it.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2012-04-23 11:47:02 +00:00
parent c2086cc7ff
commit ee8c98e5cc
3 changed files with 64 additions and 51 deletions

View file

@ -1,3 +1,12 @@
Mon Apr 23 20:35:49 2012 NAKAMURA Usaku <usa@ruby-lang.org>
* win32/win32.c (szInternalCmds, internal_match, internal_cmd_match):
get rid of a segmentation fault with GCC 4.7.0.
reported by raylinn@gmail.com (ray linn) at [ruby-core:44505]
[Bug #6333], and patched by mame.
* test/ruby/test_system.rb (TestSystem#test_system): test for it.
Mon Apr 23 20:11:02 2012 Tanaka Akira <akr@fsij.org>
* lib/drb/ssl.rb: generate 1024 bits RSA key instead of 512 bits.

View file

@ -84,6 +84,10 @@ class TestSystem < Test::Unit::TestCase
ENV["PATH"] = path
end
File.unlink tmpfilename
testname = '[ruby-core:44505]'
assert_match /Windows/, `ver`, testname
assert_equal 0, $?.to_i, testname
end
}
end

View file

@ -844,62 +844,62 @@ FindFreeChildSlot(void)
98cmd ntcmd
*/
static const char *const szInternalCmds[] = {
"\2" "assoc" + 1,
"\3" "break" + 1,
"\3" "call" + 1,
"\3" "cd" + 1,
"\1" "chcp" + 1,
"\3" "chdir" + 1,
"\3" "cls" + 1,
"\2" "color" + 1,
"\3" "copy" + 1,
"\1" "ctty" + 1,
"\3" "date" + 1,
"\3" "del" + 1,
"\3" "dir" + 1,
"\3" "echo" + 1,
"\2" "endlocal" + 1,
"\3" "erase" + 1,
"\3" "exit" + 1,
"\3" "for" + 1,
"\2" "ftype" + 1,
"\3" "goto" + 1,
"\3" "if" + 1,
"\1" "lfnfor" + 1,
"\1" "lh" + 1,
"\1" "lock" + 1,
"\3" "md" + 1,
"\3" "mkdir" + 1,
"\2" "move" + 1,
"\3" "path" + 1,
"\3" "pause" + 1,
"\2" "popd" + 1,
"\3" "prompt" + 1,
"\2" "pushd" + 1,
"\3" "rd" + 1,
"\3" "rem" + 1,
"\3" "ren" + 1,
"\3" "rename" + 1,
"\3" "rmdir" + 1,
"\3" "set" + 1,
"\2" "setlocal" + 1,
"\3" "shift" + 1,
"\2" "start" + 1,
"\3" "time" + 1,
"\2" "title" + 1,
"\1" "truename" + 1,
"\3" "type" + 1,
"\1" "unlock" + 1,
"\3" "ver" + 1,
"\3" "verify" + 1,
"\3" "vol" + 1,
"\2" "assoc",
"\3" "break",
"\3" "call",
"\3" "cd",
"\1" "chcp",
"\3" "chdir",
"\3" "cls",
"\2" "color",
"\3" "copy",
"\1" "ctty",
"\3" "date",
"\3" "del",
"\3" "dir",
"\3" "echo",
"\2" "endlocal",
"\3" "erase",
"\3" "exit",
"\3" "for",
"\2" "ftype",
"\3" "goto",
"\3" "if",
"\1" "lfnfor",
"\1" "lh",
"\1" "lock",
"\3" "md",
"\3" "mkdir",
"\2" "move",
"\3" "path",
"\3" "pause",
"\2" "popd",
"\3" "prompt",
"\2" "pushd",
"\3" "rd",
"\3" "rem",
"\3" "ren",
"\3" "rename",
"\3" "rmdir",
"\3" "set",
"\2" "setlocal",
"\3" "shift",
"\2" "start",
"\3" "time",
"\2" "title",
"\1" "truename",
"\3" "type",
"\1" "unlock",
"\3" "ver",
"\3" "verify",
"\3" "vol",
};
/* License: Ruby's */
static int
internal_match(const void *key, const void *elem)
{
return strcmp(key, *(const char *const *)elem);
return strcmp(key, (*(const char *const *)elem) + 1);
}
/* License: Ruby's */
@ -956,7 +956,7 @@ internal_cmd_match(const char *cmdname, int nt)
sizeof(szInternalCmds) / sizeof(*szInternalCmds),
sizeof(*szInternalCmds),
internal_match);
if (!nm || !(nm[0][-1] & (nt ? 2 : 1)))
if (!nm || !(nm[0][0] & (nt ? 2 : 1)))
return 0;
return 1;
}