In this paper, we present a detailed study on the effects of x-ray exposure on data corruption in commercially available NOR and NAND flash memory devices during x-ray inspection with a high-resolution Phoenix Nanomex system from GE. We investigated role of the x-ray tube voltage, tube current, device orientation, x-ray filters and photon energy. We explored the low exposure regime in detail when the first byte errors start occurring and also determined the absorbed dose for 100% byte errors. No data corruption was observed after the normal 2D x-ray inspection and CT scans of the NOR and NAND flash memory devices under study. However, increase in the tube voltage, tube current and/or the x-ray beam size resulted in byte errors which increased exponentially with the exposure time. The byte error rate was found to be much more sensitive to the tube voltage than the tube current. It was also affected by the device orientation with respect to the x-ray beam. The NAND flash memories were found to be more susceptible to data corruption from x-ray exposure than the NOR devices examined in this work. Some NOR devices were irradiated with the monochromatic x-rays from the CHESS synchrotron facility at Cornell University. Of all the photon energies used in this study, 12 keV x-ray irradiation resulted in the highest byte error rate. In this paper, we thus present a direct proof that it is the low-energy photon absorption that plays a major role in introducing bit errors in flash memories. Commonly available low-energy x-ray filters such as Cu and Al foils were found to be effective in preventing data corruption in such devices for long exposure time. Use of lower tube voltage, lower tube current, smaller x-ray spot size, short exposure time and low-energy x-ray filters, is recommended to prevent data corruption during 2D and 3D x-ray inspection of flash memory devices and other semiconductor devices in general.