Menu

#41 asn1util IdToMib RangeCheckError

Release_37
closed-fixed
Geby
5
2021-06-18
2018-02-06
r3code
No

https://sourceforge.net/p/synalist/code/HEAD/tree/trunk/asn1util.pas#l415
function IdToMib raises RangeCheckError in call to ASNDecOIDItem.

Proposed fix:

function IdToMib(const Id: AnsiString): String;
var
  x, y, n: Integer;
begin
  Result := '';
  n := 1;
  while Length(Id) + 1 > n do
  begin
    {$RANGECHECKS OFF}
    x := ASNDecOIDItem(n, Id);
    {$RANGECHECKS ON}
    if (n - 1) = 1 then
    begin
      y := x div 40;
      x := x mod 40;
      Result := IntToStr(y);
    end;
    Result := Result + '.' + IntToStr(x);
  end;
end;

Discussion

  • Geby

    Geby - 2021-06-18
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,4 +1,3 @@
    -
     https://sourceforge.net/p/synalist/code/HEAD/tree/trunk/asn1util.pas#l415
     function IdToMib raises **RangeCheckError** in call to *ASNDecOIDItem*.
    
    • status: open --> closed-fixed
     
  • Geby

    Geby - 2021-06-18

    Fixed, thanks.

     

Log in to post a comment.

MongoDB Logo MongoDB