Could Tor be compromised by hackers, allowing them to discover your IP, etc.?
Yes, all software is subject to flaws, both in design and implementation. Tor has had them in the past, Tor also relies on OpenSSL which has had numerous vulernabilities. However, only your guard or a man-in-the-middle between your guard and you can attack a Tor clients OpenSSL.
The far larger problem, and the source of most of the large-scale hacks performed on Tor users is through the application that the user is using over Tor. For example, Tor Browser has regular updates that fix vulnerabilities. This is also why there are efforts to harden the Tor Browser to make it resistant to exploitation through the security slider, ASAN, selfrando and more.
If you read up on subjects such as Tails for instance you can get more info, I say Tails because they actually have an informative FAQ section on Tor. You have to realize nothing in itself is foolproof. A hacker can identify an originating IP at the exitpoint as the packet is no longer encrypted, and so it is typically ideal to use a Tor Bridge, and connect through a unpublished or uncommon entrypoint