-
Notifications
You must be signed in to change notification settings - Fork 343
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
`Int` suffixes could be exploited by overflow to get Set:Set in Agda 2.6.2(.1). This is fixed by switching to `Integer` suffixes.
- Loading branch information
1 parent
015759c
commit 90c6547
Showing
6 changed files
with
100 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
-- Andreas, 2021-12-22, issue #5705 reported by ksqsf | ||
|
||
open import Agda.Builtin.Equality | ||
|
||
crash : Set ≡ Set9223372036854775808 | ||
crash = refl | ||
|
||
-- This should fail, but crashes in Agda 2.6.2 due to Int overflow. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Issue5705.agda:5,15-37 | ||
Set₉₂₂₃₃₇₂₀₃₆₈₅₄₇₇₅₈₀₉ != Set₁ | ||
when checking that the expression Set₉₂₂₃₃₇₂₀₃₆₈₅₄₇₇₅₈₀₈ has type | ||
Set₁ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
-- Andreas, 2021-12-22, issue #5706 reported by Trebor-Huang | ||
-- In Agda <= 2.6.2.1, Int overflow can be exploited. | ||
|
||
-- Basically just a modified version of Russell's paradox found at | ||
-- http://liamoc.net/posts/2015-09-10-girards-paradox.html. | ||
|
||
-- -- This 64bit Int overflow got us Set:Set. | ||
-- WTF : Set₀ | ||
-- WTF = Set₁₈₄₄₆₇₄₄₀₇₃₇₀₉₅₅₁₆₁₅ | ||
-- -- 18446744073709551615 = 2^64 - 1 | ||
|
||
-- Some preliminaries, just to avoid any library imports: | ||
|
||
data _≡_ {ℓ : _} {A : Set ℓ} : A → A → Set where | ||
refl : ∀ {a} → a ≡ a | ||
|
||
record ∃ {A : Set} (P : A → Set) : Set where | ||
constructor _,_ | ||
field | ||
proj₁ : A | ||
proj₂ : P proj₁ | ||
open ∃ | ||
|
||
data ⊥ : Set where | ||
|
||
-- The rest follows the linked development of Russell's paradox. | ||
|
||
-- Naive sets (tree representation), accepted with --type-in-type. | ||
|
||
data SET : Set where | ||
set : (X : Set₁₈₄₄₆₇₄₄₀₇₃₇₀₉₅₅₁₆₁₅) → (X → SET) → SET | ||
|
||
-- Elementhood | ||
|
||
_∈_ : SET → SET → Set | ||
a ∈ set X f = ∃ λ x → a ≡ f x | ||
|
||
_∉_ : SET → SET → Set | ||
a ∉ b = (a ∈ b) → ⊥ | ||
|
||
-- The set Δ of sets that do not contain themselves. | ||
|
||
Δ : SET | ||
Δ = set (∃ λ s → s ∉ s) proj₁ | ||
|
||
-- Any member of Δ does not contain itself. | ||
|
||
x∈Δ→x∉x : ∀ {X} → X ∈ Δ → X ∉ X | ||
x∈Δ→x∉x ((Y , Y∉Y) , refl) = Y∉Y | ||
|
||
-- Δ does not contain itself. | ||
|
||
Δ∉Δ : Δ ∉ Δ | ||
Δ∉Δ Δ∈Δ = x∈Δ→x∉x Δ∈Δ Δ∈Δ | ||
|
||
-- Any set that does not contain itself lives in Δ. | ||
|
||
x∉x→x∈Δ : ∀ {X} → X ∉ X → X ∈ Δ | ||
x∉x→x∈Δ {X} X∉X = (X , X∉X) , refl | ||
|
||
-- So Δ must live in Δ, which is absurd. | ||
|
||
falso : ⊥ | ||
falso = Δ∉Δ (x∉x→x∈Δ Δ∉Δ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Issue5706.agda:31,3-6 | ||
Set₁₈₄₄₆₇₄₄₀₇₃₇₀₉₅₅₁₆₁₆ is not less or equal than Set | ||
when checking that the type | ||
(X : Set₁₈₄₄₆₇₄₄₀₇₃₇₀₉₅₅₁₆₁₅) → (X → SET) → SET of the constructor | ||
set fits in the sort Set of the datatype. |