diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2018-08-23 02:43:24 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-08-23 02:48:10 -0700 |
commit | 535b98c6b59a633ded67c2d54621696e78be491b (patch) | |
tree | 2dfdc1faf401d2c642add211d4d7e5fd2a12e7be /tensorflow/contrib/boosted_trees | |
parent | 2455e694e97f2d5101481a8df0e0a9906a69c150 (diff) |
Remove memset() for SummaryEntry in weighted quantiles. This is a bug whenever one of the template arguments is not a POD, in particular for types such as string. A memset on a struct that contains a string invalidates the internals of that class (in particular the pointer that stores the characters of the string) and causes segfaults. This allows using weighted quantiles beyond int/float like template parameters. The upstream issue with memcopy of alignment bytes used for padding has been solved separately in the meantime.
PiperOrigin-RevId: 209906298
Diffstat (limited to 'tensorflow/contrib/boosted_trees')
-rw-r--r-- | tensorflow/contrib/boosted_trees/lib/quantiles/weighted_quantiles_summary.h | 8 |
1 files changed, 0 insertions, 8 deletions
diff --git a/tensorflow/contrib/boosted_trees/lib/quantiles/weighted_quantiles_summary.h b/tensorflow/contrib/boosted_trees/lib/quantiles/weighted_quantiles_summary.h index 69bb8fd4ad..8d71a6cdbc 100644 --- a/tensorflow/contrib/boosted_trees/lib/quantiles/weighted_quantiles_summary.h +++ b/tensorflow/contrib/boosted_trees/lib/quantiles/weighted_quantiles_summary.h @@ -36,12 +36,6 @@ class WeightedQuantilesSummary { struct SummaryEntry { SummaryEntry(const ValueType& v, const WeightType& w, const WeightType& min, const WeightType& max) { - // Explicitly initialize all of memory (including padding from memory - // alignment) to allow the struct to be msan-resistant "plain old data". - // - // POD = http://en.cppreference.com/w/cpp/concept/PODType - memset(this, 0, sizeof(*this)); - value = v; weight = w; min_rank = min; @@ -49,8 +43,6 @@ class WeightedQuantilesSummary { } SummaryEntry() { - memset(this, 0, sizeof(*this)); - value = ValueType(); weight = 0; min_rank = 0; |