[1]: http://stackoverflow.com/questions/9219807/using-javascript-...
The issue you state is a property of three things:
1. The underlying language/vm allows code and data to be interchanged (c++).
2. The underlying vm allows memory to be overwritten and buffer lengths to be exceeded to start with.
3. Pdf allows arbitrary code to execute on your computer.
My point demonstrated.
Embedded JavaScript is another matter, but it's not needed to be executed for parsing the document.
_____________
¹ This gives rise to interesting applications, e.g. you can remove pages or images by just removing a link in the PDF. Yet the object would then still be there. There are some PDFs out there where sensitive information is buried in unlinked objects that still exist within the file. But that's obviously besides the point.