Well... i dont know if there are bad chemicals in low quality weed, but if you are too worried about this, make green dragon with your weed, filter it, and heat it again until the alcohol evaporate completly and there be only a black resin left. This black resin is the cannabis resin, also called hash oil. It can be smoked (its VERY strong) or mixed with oil/butter/milk/whatever to made weed edibles.

This process extracts only the important part of the cannabis (the THC containing resin) and leaves behind any other substances that are insoluble in alcohol (hopefully, most of them are).