If an honest peer sees that you're on a weaker fork, it responds by catching you up with the strongest fork that it knows.
So if you possess zero verification ability because you only have a library that implements the wire protocol, I guess you're left to hoping that you're connected to mostly honest nodes and can cross-examine their messages to infer a consensus.
https://en.bitcoin.it/wiki/Thin_Client_Security