Ada_Ru форум

Обсуждение языка Ада

ACT#587 GNAT.OS_Lib.Is_Regular_File raised PROGRAM_ERROR : EXCEPTION_ACCESS_VIOLATION

Оставить новое сообщение

Сообщения

Dmitriy Anisimkov
ACT#587 GNAT.OS_Lib.Is_Regular_File raised PROGRAM_ERROR : EXCEPTION_ACCESS_VIOLATION
2003-10-04 10:44:12

Dear GNAT support,

 

Win32 implementation of GNAT.OS_Lib.Is_Regular_File broke memory if the filename

length more than 4096 bytes.

 

GNAT version: Pro 5.01a (20030721)

OS: Windows 2000

 

Test program:

----------------------------

with Ada.Strings.Fixed;

with Ada.Text_IO;

 

with GNAT.OS_Lib;

 

procedure IsReg is

use Ada.Strings.Fixed;

use Ada.Text_IO;

 

begin

if GNAT.OS_Lib.Is_Regular_File (4096 * "a") then

Put_Line ("Exists.");

else

Put_Line ("Does not exist.");

end if;

if GNAT.OS_Lib.Is_Regular_File (4200 * "a") then

Put_Line ("Exists.");

else

Put_Line ("Does not exist.");

end if; end IsReg;

-----------------------------

 

Output:

--------------------------------

Does not exist.

 

raised PROGRAM_ERROR : EXCEPTION_ACCESS_VIOLATION

--------------------------------

 

See adaint.c line 1290

-------------------------

#ifdef _WIN32

/* Under Windows the directory name for the stat function must not be

terminated by a directory separator except if just after a drive name. */

int name_len = strlen (name);

char last_char = name[name_len - 1];

char win32_name[4096];

 

strcpy (win32_name, name);

__^^^^^^^^^^^^^^^^^^^^^^^^^^

 

Write to the stack if name longer than 4096 bytes.

Новое сообщение:
Страницы: 1

Чтобы оставить новое сообщение необходимо Зарегистрироваться и Войти