cat / 012
clone

a spreadsheet for the terminal: lotus 1-2-3 looks, google sheets keys and formulas, one go binary

Files: layout fields in the streaming reader's seeds; a key without a value refused

Dami committed 7631e49
The file seeds for the streaming reader hold wrapping, borders, row
heights and merges, written and by hand (valid and not), so FuzzRead
checks them against reading the whole file. Fuzzing found the streaming
reader taking a key with no value ("sheets":,) as absent where
encoding/json refuses the file; now it refuses it too, and the case is
kept as a seed. A number with a style that wraps or draws borders is
read the general way, so the rows it shapes are indexed.
commit
7631e49272a4300b9af7f7bd4c36af37ec57207d
parent
39374af3c3cc4ea1e6637906008f1279dde65784
author
Dami <dami.etoile@gmail.com>
kind
fix risk score 1.4 of 3, Jev's estimate
3 files changed, +14 -0
Minternal/sheet/filescan.go3+++
Minternal/sheet/filestream_test.go9+++++++++
Ainternal/sheet/testdata/fuzz/FuzzRead/cefb43b386e48dd32++
M internal/sheet/filescan.go +3 -0
M internal/sheet/filestream_test.go +9 -0
@@ -187,6 +187,12 @@ func streamSeeds(t testing.TB) [][]byte {
187187 s.SetStyle(NewRect(Addr{Row: 11}, Addr{Col: 3, Row: 11}), func(st *Style) { st.Bold = true })188188 s.SetNote(Addr{Col: 5, Row: 1}, "a note")189189 s.SetColWidth(1, 20)190+ s.SetStyle(NewRect(Addr{Row: 4}, Addr{Row: 4}), func(st *Style) { st.Wrap = WrapOn })191+ s.SetStyle(NewRect(Addr{Col: 4}, Addr{Col: 4, Row: MaxRows - 1}), func(st *Style) { st.Wrap = WrapClip })192+ s.SetBorders(NewRect(Addr{Row: 1}, Addr{Col: 2, Row: 3}), BorderAll, LineThin)193+ s.SetBorders(NewRect(Addr{Row: 1}, Addr{Col: 2, Row: 3}), BorderOuter, LineDouble)194+ s.SetRowHeight(6, 7, 3)195+ s.LoadMerge(NewRect(Addr{Col: 6}, Addr{Col: 8, Row: 1}))190196 one := []byte(written(t, s.Book()))191197 if _, err := s.Book().AddSheet("Other", 1); err != nil {192198 t.Fatal(err)
@@ -211,6 +217,9 @@ func streamSeeds(t testing.TB) [][]byte {
211217 []byte(`{"version": 4, "cells": "x", "sheets": []}`),212218 []byte(`{"version": 2, "cells": {"A1": "😀", "A2": "bad \xff", "ZZ9": 5}}`),213219 []byte(`{"version": 2, "cells": {"A1": "1"}} trailing`),220+ []byte(`{"version": 2, "heights": {"2": 3, "9": 99}, "merges": ["A1:B1", "B1:C2", "D4"], "cells": {"A1": {"input": "5", "wrap": "wrap", "borders": {"top": "thin", "right": "double"}}}}`),221+ []byte(`{"version": 2, "cells": {"A1": {"input": "x", "wrap": "sideways"}, "B1": {"borders": {"left": "dotted"}}}}`),222+ []byte(`{"version": 2, "heights": {"0": 2}, "merges": ["A1:"], "cells": {}}`),214223 []byte(`null`), []byte(`[]`), []byte(`{"version": 2, "cells": {"A1": "1",}}`), []byte(`{"version": 2, "cells": {"A1"`),215224 }216225 }
A internal/sheet/testdata/fuzz/FuzzRead/cefb43b386e48dd3 +2 -0