Natools

Check-in [23d16059bd]
Login
Overview
Comment:smaz_implementations-base_64: fix reading of 3n+2 verbatim length

A sign error caused a direct constraint error, and using the wrong type caused overlong reads (now 4 is hardcoded just like it is in encoding code).

Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 23d16059bdc0c6bd97de497cfd26b08c97cefc5c
User & Date: nat on 2016-12-28 22:29:15
Other Links: manifest | tags
Context
2016-12-29
21:47
smaz_implementations-base_64: fix index update in encoding 3n+2 vrbtim check-in: ebba07e9a7 user: nat tags: trunk
2016-12-28
22:29
smaz_implementations-base_64: fix reading of 3n+2 verbatim length

A sign error caused a direct constraint error, and using the wrong type caused overlong reads (now 4 is hardcoded just like it is in encoding code). check-in: 23d16059bd user: nat tags: trunk

2016-12-27
21:28
smaz_tests: fix message of exceptions during decompression roundtrip check-in: 77d59bd0f4 user: nat tags: trunk
Changes

Modified src/natools-smaz_implementations-base_64.adb from [eb6acaef96] to [79f9fdb2bc].

56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
         Tools.Decode_Single (Input, Offset, Ignored (1), Code);
         Verbatim_Length := Natural (Code) * 3 + 1;
         Offset := Offset_Backup;
         Code := 0;

      else
         Offset_Backup := Offset;
         Verbatim_Length := (Natural (Code) - 61)
                          * (Natural (Tools.Single_Byte_Padding'Last) + 1);
         Tools.Decode_Double (Input, Offset, Ignored, Code);
         Verbatim_Length := (Verbatim_Length + Natural (Code)) * 3 + 2;
         Offset := Offset_Backup;
         Code := 0;
      end if;
   end Read_Code;








|
<







56
57
58
59
60
61
62
63

64
65
66
67
68
69
70
         Tools.Decode_Single (Input, Offset, Ignored (1), Code);
         Verbatim_Length := Natural (Code) * 3 + 1;
         Offset := Offset_Backup;
         Code := 0;

      else
         Offset_Backup := Offset;
         Verbatim_Length := (61 - Natural (Code)) * 4;

         Tools.Decode_Double (Input, Offset, Ignored, Code);
         Verbatim_Length := (Verbatim_Length + Natural (Code)) * 3 + 2;
         Offset := Offset_Backup;
         Code := 0;
      end if;
   end Read_Code;