GNAT附带的AUnit存在漏洞

3

我相信我已经找到并修复了AUnit中的一个bug,该bug作为Ada编译器工具GNAT的一部分提供。

向AdaCore提交关于他们的GNAT工具社区版本的漏洞,最佳方法是什么?

以下程序在当前版本的编译器GNAT Community 2020(20200429-84)中悄无声息地中止。

with Ada.Text_IO;use Ada.Text_IO;
with AUnit.Test_Filters;
with AUnit.Tests;

procedure Message_Allocation is

   package Filter_Package is
      type Filter_Type is new AUnit.Test_Filters.Name_Filter with null record;

      function Is_Active
     (Filter : Filter_Type;
      T      : AUnit.Tests.Test'Class) return Boolean;

   end Filter_Package;

   package body Filter_Package is
      function Is_Active
     (Filter : Filter_Type;
      T      : AUnit.Tests.Test'Class) return Boolean is begin return true; end is_active;
   end Filter_Package;

   filter : Filter_Package.filter_type;

begin
   Put_Line ("set 1st filter");
   filter.set_name ("abc");
   Put_Line ("set 2nd filter");
   filter.set_name ("xyz");
   Put_Line ("2nd filter set");

end Message_Allocation;

错误位于文件 aunit.adb 中的 Message_Free 过程中。下面是修补过的版本,改动在调用 AUnit.Memory.AUnit_Free 的参数上。
   procedure Message_Free (Msg : in out Message_String) is
   begin
      if Msg /= null then
         AUnit.Memory.AUnit_Free (Msg.all'address - System.Address'size/8);
         Msg := null;
      end if;
   end Message_Free;

System.Address'size/8 看起来有点不对劲。它应该是 System.Address'size/System.Storage_Unit 吗? - user1818839
1
@BrianDrummond,Message_Alloc 中有字面量 8。我认为它实际上应该是 Bounds'Object_Size / 8Bounds 是两个整数)。 - Simon Wright
2个回答

2

发邮件至:report@(制造GNAT的公司名称).com

如果您能提供有意义的标题和有用的信息来展示错误(通常是复现示例)和您的修复方法,那么您增加了解决问题的机会。


1

1
如果你还没有在Github上设置好,我可以为你做这件事(顺便说一句,如果在macOS上错误信息不够详细,那么恭喜你找到了这个)。 - Simon Wright

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接