Integer overflow on armhf, test error

Bug #1884152 reported by Andreas Hasenack on 2020-06-18
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
golang-github-miekg-dns (Ubuntu)
Undecided
Unassigned

Bug Description

This test is failing on armhf:

```
=== RUN TestGenerateRangeGuard
    TestGenerateRangeGuard: generate_test.go:81: expected

        @ IN SOA ns.test. hostmaster.test. ( 1 8h 2h 7d 1d )
        $GENERATE 0-2 dhcp-${2147483647,4,d} A 10.0.0.$

        to fail, but got no error
--- FAIL: TestGenerateRangeGuard (0.01s)
```
I believe this was introduced in commit c0283a2028317d3fb6574f9a06e68443cf6b89cd which added this check:
```golang
                        if r.start+offset < 0 || r.end+offset > 1<<31-1 {
                                return 0, r.parseError("bad offset in $GENERATE", si+3+sep)
                        }
```

The test will reach (1<<31-1)+2, meaning `r.end+offset` on 32bits systems will become negative and thus not trigger the condition above.

Upstream bug report: https://github.com/miekg/dns/issues/1129

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers