Skip to content

Commit 89713f5

Browse files
committed
ffc_sv_create: zero just the length
The array shouldn't need to be zero-initialized. We should never read from any element of the array that has not been initialized by a push or extend
1 parent f162694 commit 89713f5

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

ffc.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1640,7 +1640,8 @@ bool ffc_sv_try_extend(ffc_sv* sv, ffc_bigint_limb_span s) {
16401640
// create from existing limb span.
16411641
ffc_internal ffc_inline
16421642
ffc_sv ffc_sv_create(ffc_bigint_limb_span s) {
1643-
ffc_sv new_one = {0};
1643+
ffc_sv new_one;
1644+
new_one.len = 0;
16441645
ffc_sv_try_extend(&new_one, s);
16451646
return new_one;
16461647
}

src/bigint.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ bool ffc_sv_try_extend(ffc_sv* sv, ffc_bigint_limb_span s) {
7777
// create from existing limb span.
7878
ffc_internal ffc_inline
7979
ffc_sv ffc_sv_create(ffc_bigint_limb_span s) {
80-
ffc_sv new_one = {0};
80+
ffc_sv new_one;
81+
new_one.len = 0;
8182
ffc_sv_try_extend(&new_one, s);
8283
return new_one;
8384
}

0 commit comments

Comments
 (0)