If the book is released under Creative Commons license, or is on the author's site to download, or the site has the author's permission to offer it for download, it's legal. (Copyright law is, at its base, simple - only the author of an original work has the right to make copies, or to authorize someone else to make copies.)
As far as whether there are viruses, etc., there can be a virus in a Google ad. If you're not running a good antivirus app and a good antimalware app, at the very least, you're being careless.