summaryrefslogtreecommitdiff
path: root/test/bug-277.c
Commit message (Collapse)AuthorAgeFilesLines
* script: Implement device finishUli Schlachter2022-03-081-0/+94
Before this commit, calling cairo_device_finish() on a cairo-script context did not actually do anything in the backend. Thus, it was possible to continue emitting output on the script context even after it was finished, which means that API user had no way of preventing use-after-free bugs in their write callback. Bug 277 triggers this via detaching a snapshot, but I guess one could also simply continue drawing to a script surface. This commit implements the finish function by closing the underlying stream. However, that was not enough to fix things. This commit also turns writing into a stream into a no-op after the stream was closed. I checked that the new test case actually fails before this commit and is indeed fixed by it. Fixes: https://gitlab.freedesktop.org/cairo/cairo/-/issues/277 Signed-off-by: Uli Schlachter <psychon@znc.in>