marker output is also
| 5944 | |
| 5945 | // marker output is also |
| 5946 | static int ReadOffsets(OffsetData& offset_data, |
| 5947 | const unsigned char* head, |
| 5948 | const unsigned char*& marker, |
| 5949 | const size_t size, |
| 5950 | const char** err) { |
| 5951 | for (unsigned int l = 0; l < offset_data.offsets.size(); ++l) { |
| 5952 | for (unsigned int dy = 0; dy < offset_data.offsets[l].size(); ++dy) { |
| 5953 | for (unsigned int dx = 0; dx < offset_data.offsets[l][dy].size(); ++dx) { |
| 5954 | tinyexr::tinyexr_uint64 offset; |
| 5955 | if ((marker + sizeof(tinyexr_uint64)) >= (head + size)) { |
| 5956 | tinyexr::SetErrorMessage("Insufficient data size in offset table.", err); |
| 5957 | return TINYEXR_ERROR_INVALID_DATA; |
| 5958 | } |
| 5959 | |
| 5960 | memcpy(&offset, marker, sizeof(tinyexr::tinyexr_uint64)); |
| 5961 | tinyexr::swap8(&offset); |
| 5962 | if (offset >= size) { |
| 5963 | tinyexr::SetErrorMessage("Invalid offset value in DecodeEXRImage.", err); |
| 5964 | return TINYEXR_ERROR_INVALID_DATA; |
| 5965 | } |
| 5966 | marker += sizeof(tinyexr::tinyexr_uint64); // = 8 |
| 5967 | offset_data.offsets[l][dy][dx] = offset; |
| 5968 | } |
| 5969 | } |
| 5970 | } |
| 5971 | return TINYEXR_SUCCESS; |
| 5972 | } |
| 5973 | |
| 5974 | static int DecodeEXRImage(EXRImage *exr_image, const EXRHeader *exr_header, |
| 5975 | const unsigned char *head, |
no test coverage detected