From d7050ad5481a1a6dc958816655a4535cd2fd2df2 Mon Sep 17 00:00:00 2001 From: Peter Griess Date: Fri, 22 Mar 2013 08:12:30 -0700 Subject: [PATCH] Enable Elf::at only for POD data types Summary: - Make sure that the utility function Elf::at only works for POD datatypes, as it uses reinterpret_cast. Test Plan: - Unit tests Reviewed By: simpkins@fb.com FB internal diff: D748314 --- folly/experimental/symbolizer/Elf.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/folly/experimental/symbolizer/Elf.h b/folly/experimental/symbolizer/Elf.h index 88eae5e3..91f587c2 100644 --- a/folly/experimental/symbolizer/Elf.h +++ b/folly/experimental/symbolizer/Elf.h @@ -123,7 +123,8 @@ class ElfFile { void validateStringTable(const ElfW(Shdr)& stringTable) const; template - const T& at(off_t offset) const { + const typename std::enable_if::value, T>::type& + at(off_t offset) const { return *reinterpret_cast(file_ + offset); } -- 2.34.1