Overview
Comment: | chunked_strings: fix a bug where Index checks beyond string upper bound |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
b2d601f43d94c23464543dda8e23617e |
User & Date: | nat on 2013-10-11 21:51:08 |
Other Links: | manifest | tags |
Context
2013-10-12
| ||
17:23 | string_slice_set_tests: check exceptions raised check-in: c84924dbd6 user: nat tags: trunk | |
2013-10-11
| ||
21:51 | chunked_strings: fix a bug where Index checks beyond string upper bound check-in: b2d601f43d user: nat tags: trunk | |
2013-10-10
| ||
21:23 | chunked_strings-tests-bugfixes: new test case exposing a bug check-in: 278fda3aa5 user: nat tags: trunk | |
Changes
Modified src/natools-chunked_strings.adb from [dc49608feb] to [ba9d2b7b2a].
︙ | ︙ | |||
1450 1451 1452 1453 1454 1455 1456 | raise Ada.Strings.Index_Error; end if; case (Going) is when Ada.Strings.Forward => loop Result := Ada.Strings.Fixed.Index | | > > > > | > > > > | 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 | raise Ada.Strings.Index_Error; end if; case (Going) is when Ada.Strings.Forward => loop Result := Ada.Strings.Fixed.Index (Source.Data (Chunk).all (1 .. Positive'Min (Source.Size - (Chunk - 1) * Source.Chunk_Size, Source.Chunk_Size)), Set, Offset, Test, Going); if Result /= 0 then return (Chunk - 1) * Source.Chunk_Size + Result; end if; if Chunk = Source.Data'Last then return 0; end if; Chunk := Chunk + 1; Offset := 1; end loop; when Ada.Strings.Backward => loop Result := Ada.Strings.Fixed.Index (Source.Data (Chunk).all (1 .. Positive'Min (Source.Size - (Chunk - 1) * Source.Chunk_Size, Source.Chunk_Size)), Set, Offset, Test, Going); if Result /= 0 then return (Chunk - 1) * Source.Chunk_Size + Result; end if; if Chunk = Source.Data'First then return 0; end if; Chunk := Chunk - 1; |
︙ | ︙ |