Obviously if you find bug-infested flour (and you aren't living in Mauritania) the immediate next step is to throw out the flour, but what if the bag had been sitting on the shelf for a while? How can you be sure they haven't gotten into something else?
Every time we bring a new bag of flour home (and we go through a LOT of flour in our house), we either stick it in the microwave for 10-15 seconds on high, or if we have room we just store it in the freezer. Either method kills any bugs that might be in there and ensures that they won't get into anything else before you've found them. You'll still have to throw the bag out, but at least you won't have to dump the whole pantry and call the exterminator.
Visit Rocks In My Dryer for more helpful hints.