Skip to content

Commit 8abeec7

Browse files
Gate fuzz oracles on documented SQLite3MC findings (#28)
* Fix shared_cache oracle to require siblings keyed like main * Gate fuzz oracles on documented SQLite3MC findings
1 parent 000f8d2 commit 8abeec7

13 files changed

Lines changed: 136 additions & 53 deletions
364 Bytes
Binary file not shown.

‎fuzz/corpus/findings/backup-rc4-small-page-short-read‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@���j�x㹖�� ��|�
2+
1\��9h� &�4����̢Nx���*�n���j�x㹖�� ��|�
3+
PJ[�;i��2�'Z � .|�W��F�zs�j��)yI�ú��O$��H���D
100 Bytes
Binary file not shown.

‎fuzz/corpus/shared_cache/all-siblings-correct-key‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
���'�L7�HpM�[/���Qs�Φ��x�C�,�� � �۳�nR�F�=D�_�6�p
2+
�+�H��%���}�$���q��혷���%܁�y���F |���2Jy�X1�Y�N�mٵ�YV�$��0�ܮ���C��9١<�bW�K^�~[N@��D�v��*���ː��]b���H�&x����#WLIgY�X�$"��I�}d[�B����䗅<6!��nĀ`��['ǿWg������l6\���[�>���HWh���X��cP�TטA
3+
K����H�sqio�G6���t�x�2��vꌳL|��
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
�{�9�Ao�'�$�6*6y��hu����,�\���!S��M.r�Hӟ��p3;ƹPm-�!�\C���If�ڲ�����&�ת��������4��fg��`�����Hj� oq<�^x��lHI��Y�7'�4G�1�ԉ����c�����]-mV��E�p�2�_�n�6���7�'< ��0|m��I���J~rN�.�D�E�X��FJ���
915 Bytes
Binary file not shown.
878 Bytes
Binary file not shown.
249 Bytes
Binary file not shown.
249 Bytes
Binary file not shown.

‎fuzz/examples/gen_shared_cache_seeds.rs‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,17 @@ use std::path::Path;
1010
use sqlite3mc_src_fuzz::{
1111
run_shared_cache,
1212
seedgen::{run_search, DivergencePolicy, Family, Rng},
13-
SharedCacheCase,
13+
SharedCacheCase, SiblingKey,
1414
};
1515

1616
const fn has_content(case: &SharedCacheCase) -> bool {
1717
!case.main_ops.is_empty()
1818
}
1919

20+
const fn shared(key: &SiblingKey) -> bool {
21+
matches!(key, SiblingKey::Shared)
22+
}
23+
2024
fn families() -> &'static [Family<SharedCacheCase>] {
2125
&[
2226
Family {
@@ -25,15 +29,11 @@ fn families() -> &'static [Family<SharedCacheCase>] {
2529
},
2630
Family {
2731
name: "one-sibling-correct-key",
28-
matches: |c| {
29-
c.siblings.len() == 1 && c.siblings[0].config == c.written && has_content(c)
30-
},
32+
matches: |c| c.siblings.len() == 1 && shared(&c.siblings[0].key) && has_content(c),
3133
},
3234
Family {
3335
name: "one-sibling-wrong-key",
34-
matches: |c| {
35-
c.siblings.len() == 1 && c.siblings[0].config != c.written && has_content(c)
36-
},
36+
matches: |c| c.siblings.len() == 1 && !shared(&c.siblings[0].key) && has_content(c),
3737
},
3838
Family {
3939
name: "many-siblings",
@@ -47,16 +47,16 @@ fn families() -> &'static [Family<SharedCacheCase>] {
4747
name: "all-siblings-correct-key",
4848
matches: |c| {
4949
!c.siblings.is_empty()
50-
&& c.siblings.iter().all(|s| s.config == c.written)
50+
&& c.siblings.iter().all(|s| shared(&s.key))
5151
&& has_content(c)
5252
},
5353
},
5454
Family {
5555
name: "mixed-correct-and-wrong",
5656
matches: |c| {
5757
c.siblings.len() >= 2
58-
&& c.siblings.iter().any(|s| s.config == c.written)
59-
&& c.siblings.iter().any(|s| s.config != c.written)
58+
&& c.siblings.iter().any(|s| shared(&s.key))
59+
&& c.siblings.iter().any(|s| !shared(&s.key))
6060
&& has_content(c)
6161
},
6262
},

0 commit comments

Comments
 (0)