delphidabbler / vied

Version Information Editor for Windows
https://delphidabbler.com/software/vied
9 stars 4 forks source link

Fix potential bug in .vi file section reading code #78

Closed delphidabbler closed 1 month ago

delphidabbler commented 1 month ago

The keys within a section are case sensitive, but the dictionary used to store them has an ambiguous comparer object. The Hash function is case sensitive, but the equality function is not:

  fEntries := TDictionary<string,string>.Create(
    TDelegatedEqualityComparer<string>.Create(
      function(const Left, Right: string): Boolean
      begin
        Result := SameText(Left, Right, loInvariantLocale);
      end,
      function(const Value: string): Integer
      begin
        Result := ElfHash(Value);
      end
    )
  );

To ensure consistency the equality function should changed to be case sensitive:

      function(const Left, Right: string): Boolean
      begin
        Result := SameStr(Left, Right, loInvariantLocale);
      end,
delphidabbler commented 1 month ago

Forgot to say that this code is in UVIData.TVIDataSection.Create

delphidabbler commented 1 month ago

Implemented at commit b3f62b31ba51371259b74bc2bb6be07ef0740df4