Brazil has a very bad press in terms of violence and certainly there are no-go areas where you would be ill advised to go. However, it is nothing like as bad as it is made out to be. Normal precautions like not standing out as a tourist apply, e.g. no expensive jewellery, no camera slung round your neck, no computers taken out in public. It is also wise to carry a xerox copy of your passport, medical insurance and card insurance on you, as well as keeping money in different pockets. (See useful links for insurance)