Lurker News
I realized that the PDF engines of modern desktop browsers (PDFium and PDF.js) support JavaScript with enough I/O primitives to make a basic game like Tetris.

It was a bit tricky to find a union of features that work in both engines, but in the end it turns out that showing/hiding annotation "fields" works well to make monochrome pixels, and keyboard input can be achieved by typing in a text input box.
All in all it's quite janky but a nice reminder of how general purpose PDF scripting can be. The linked PDF is all ASCII so you can just open it in a text editor, or have a look at the source code here: https://github.com/ThomasRinsma/pdftris/blob/main/gengrid.py

Comments (223) 81 threads

Earlier comments
geor9e1 reply#
A tetris PDF could be in a 1 pixel iframe right on this page and you'd never know it. So it doesn't require any user action to download one.
sexy_seedbox2 replies#
That's why you run NoScript along side with UBO
geor9e1 reply#
I'm pretty sure noscript will break 90% of the webpages I visit. I just rawdog the internet. If Chrome gets 0day'd then a lot of us are going down - at least I'll have company.

Continue this thread — 1 reply

grgergo#
This PDF still runs with JS disabled in both of those, and in Firefox about:config...
poincaredisk2 replies#
The vulnerability was in images parsing, and exploit was distributed by sending an imessage to the target. So don't open any images, and don't read imessages. They are also known to use browser exploits, so don't visit random websites.

That was sarcasm, in case it's not clear over the internet. Telling people to avoid "suspicious" pdfs/websites is common but ultimately not very useful advice.
The real takeaway is: don't become a target of a nation state intelligence agency. If you own a phone, they can take over it, and there's nothing you can do.

cess11#
The Pegasus Project has shown that pretty much anyone could be targeted. It's enough to know someone in a publicly owned company or publicly say something negative about corruption or just be in the wrong place at the wrong time.

Nothing you do will guarantee that the state won't come after you.

eximius#
Interesting!

Something neat I found, you're able to 'clip' the blocks into each other by spinning them right before the block settles.

jeffhuys#
I actually am kind-of happy that this doesn't work on Mac (if you don't install Acrobat) / preview.
rhokstar1 reply#
I would be surprised if Doom was playable in a PDF that was being read in a LCD screen of a thermometer.
brettermeier#
You would or wouldn't be surprised?

Load more comments