Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Docx writer crashes on invalid tables #8102

@tarleb

Description

@tarleb

The docx writer crashes with error pandoc: Error in array index when processing an inconsistent/invalid table that has fewer cells in a row than expected. This only shows when processing JSON or native input, as in those cases the tables are not necessarily normalized:

[ Table
    ( "" , [] , [] )
    (Caption Nothing [])
    [ ( AlignLeft , ColWidth 0.5 )
    , ( AlignLeft , ColWidth 0.5 )
    ]
    (TableHead ( "" , [] , [] ) [])
    [ TableBody
        ( "" , [] , [] )
        (RowHeadColumns 1)
        []
        [ Row
            ( "" , [] , [] )
            [ Cell
                ( "" , [] , [] )
                AlignLeft
                (RowSpan 1)
                (ColSpan 1)
                [ Plain [ Str "single" ] ]
            ]
        , Row
            ( "" , [] , [] )
            [ Cell
                ( "" , [] , [] )
                AlignLeft
                (RowSpan 1)
                (ColSpan 1)
                [ Plain [ Str "one" ] ]
            , Cell
                ( "" , [] , [] )
                AlignLeft
                (RowSpan 1)
                (ColSpan 1)
                [ Plain [ Str "two" ] ]
            ]
        ]
    ]
    (TableFoot ( "footer" , [] , [] ) [])
]

The second row in the table above is necessary to trigger the error.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions