Skip to content

Commit df5a9e2

Browse files
author
matz
committed
mbc bug in regex
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_3@471 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent c598694 commit df5a9e2

File tree

6 files changed

+35
-13
lines changed

6 files changed

+35
-13
lines changed

ChangeLog

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
Tue May 18 15:25:45 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
2+
3+
* regex.c (re_search): a bug in range adjustment.
4+
5+
Tue May 18 11:35:59 1999 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
6+
7+
* dln.c (conv_to_posix_path): path_len argument added.
8+
19
Mon May 17 12:26:31 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
210

311
* numeric.c (fix_rev): should treat Fixnum as signed long.
@@ -287,7 +295,7 @@ Fri Apr 16 15:09:20 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
287295

288296
* config.guess: avoid 'linux-gnu' for alpha-unknown-linux.
289297

290-
Thu Apr 15 23:46:20 1999 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
298+
Thu Apr 15 23:46:20 1999 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
291299

292300
* ruby.c (rubylib_mangle): mangle path by RUBYLIB_PREFIX.
293301

dln.c

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ int eaccess();
7878
#endif
7979

8080
#ifndef FUNCNAME_PATTERN
81-
# if defined(__hp9000s300) || (defined(__NetBSD__) && (!defined(__alpha__) && !defined(__mips__))) || defined(__BORLANDC__) || (defined(__FreeBSD__) && __FreeBSD__ < 3) || defined(NeXT) || defined(__WATCOMC__)
81+
# if defined(__hp9000s300) || (defined(__NetBSD__) && (!defined(__alpha__) && !defined(__mips__))) || defined(__BORLANDC__) || (defined(__FreeBSD__) && __FreeBSD__ < 3) || defined(NeXT) || defined(__WATCOMC__) || defined(__APPLE__)
8282
# define FUNCNAME_PATTERN "_Init_%.200s"
8383
# else
8484
# define FUNCNAME_PATTERN "Init_%.200s"
@@ -1095,6 +1095,10 @@ dln_sym(name)
10951095
#include <mach-o/dyld.h>
10961096
#endif
10971097
#endif
1098+
#ifdef __APPLE__
1099+
#include <mach-o/dyld.h>
1100+
#endif
1101+
10981102

10991103
#ifdef _WIN32
11001104
#include <windows.h>
@@ -1356,7 +1360,7 @@ dln_load(file)
13561360
}
13571361
#endif /* _AIX */
13581362

1359-
#ifdef NeXT
1363+
#if defined(NeXT) || defined(__APPLE__)
13601364
#define DLN_DEFINED
13611365
/*----------------------------------------------------
13621366
By SHIROYAMA Takayuki Psi@fortune.nest.or.jp
@@ -1366,7 +1370,8 @@ dln_load(file)
13661370
Mi hisho@tasihara.nest.or.jp,
13671371
and... Miss ARAI Akino(^^;)
13681372
----------------------------------------------------*/
1369-
#if NS_TARGET_MAJOR < 4 /* NeXTSTEP rld functions */
1373+
#if defined(NeXT) && ( NS_TARGET_MAJOR < 4 )/* NeXTSTEP rld functions */
1374+
13701375
{
13711376
unsigned long init_address;
13721377
char *object_files[2] = {NULL, NULL};
@@ -1572,9 +1577,10 @@ dln_find_file(fname, path)
15721577

15731578
#if defined(__CYGWIN32__)
15741579
const char *
1575-
conv_to_posix_path(win32, posix)
1580+
conv_to_posix_path(win32, posix, len)
15761581
char *win32;
15771582
char *posix;
1583+
int len;
15781584
{
15791585
char *first = win32;
15801586
char *p = win32;
@@ -1589,7 +1595,10 @@ conv_to_posix_path(win32, posix)
15891595
first = p + 1;
15901596
*p = ';';
15911597
}
1592-
cygwin32_conv_to_posix_path(first, posix);
1598+
if (len < strlen(first))
1599+
fprintf(stderr, "PATH length too long: %s\n", first);
1600+
else
1601+
strcpy(posix, first);
15931602
return dst;
15941603
}
15951604
#endif
@@ -1612,8 +1621,10 @@ dln_find_1(fname, path, exe_flag)
16121621
#endif
16131622

16141623
#if defined(__CYGWIN32__)
1615-
char rubypath[MAXPATHLEN];
1616-
conv_to_posix_path(path, rubypath);
1624+
int pathlen = 2 * strlen(path);
1625+
int rubypathlen = pathlen > MAXPATHLEN ? pathlen : MAXPATHLEN;
1626+
char *rubypath = alloca(rubypathlen);
1627+
conv_to_posix_path(path, rubypath, rubypathlen);
16171628
path = rubypath;
16181629
#endif
16191630
if (fname[0] == '/') return fname;

ext/extmk.rb.nt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ VPATH = .
322322
323323
CC = cl
324324
325-
CFLAGS = %s -I../.. -I../../missing -I../../win32 -I. -O -DNT %s #{CFLAGS} #$CFLAGS %s
325+
CFLAGS = %s -I../.. -I../../missing -I../../win32 -I. -O -DNT %s #{CFLAGS} #{$CFLAGS} %s
326326
327327
RUBYLIB = ../../ruby.lib
328328
DLDFLAGS = /DLL
@@ -436,6 +436,7 @@ def extmake(target)
436436

437437
return if $nodynamic and not $static
438438

439+
$objs = nil
439440
$LOCAL_LIBS = "" # to be assigned in extconf.rb
440441
$CFLAGS = ""
441442
$LDFLAGS = ""

io.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2163,7 +2163,7 @@ next_argv()
21632163
}
21642164
file = prep_stdio(fr, FMODE_READABLE, rb_cFile);
21652165
}
2166-
rb_io_binmode(file);
2166+
if (binmode) rb_io_binmode(file);
21672167
}
21682168
else {
21692169
init_p = 0;

regex.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2968,9 +2968,11 @@ re_search(bufp, string, size, startpos, range, regs)
29682968
while (range > 0) {
29692969
c = *p++;
29702970
if (ismbchar(c)) {
2971-
int len = mbclen(c) - 1;
2971+
int len;
2972+
29722973
if (fastmap[c])
29732974
break;
2975+
len = mbclen(c) - 1;
29742976
while (len--) {
29752977
c = *p++;
29762978
range--;
@@ -2981,8 +2983,8 @@ re_search(bufp, string, size, startpos, range, regs)
29812983
else {
29822984
if (fastmap[MAY_TRANSLATE() ? translate[c] : c])
29832985
break;
2984-
range--;
29852986
}
2987+
range--;
29862988
}
29872989
startpos_adjust:
29882990
startpos += irange - range;

ruby.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ addpath(path)
191191
#if defined(__CYGWIN32__)
192192
{
193193
char rubylib[FILENAME_MAX];
194-
conv_to_posix_path(path, rubylib);
194+
conv_to_posix_path(path, rubylib, FILENAME_MAX);
195195
path = rubylib;
196196
}
197197
#endif

0 commit comments

Comments
 (0)