// -*- C++ -*- // Boost general library format --------------------------- // See http://www.boost.org for updates, documentation, and revision history. // (C) Samuel Krempp 2001 // krempp@crans.ens-cachan.fr // Permission to copy, use, modify, sell and // distribute this software is granted provided this copyright notice appears // in all copies. This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // ideas taken from Rüdiger Loos's format class // and Karl Nelson's ofstream // ---------------------------------------------------------------------------- // format_implementation.hpp Implementation of the basic_format class // ---------------------------------------------------------------------------- #ifndef BOOST_FORMAT_IMPLEMENTATION_HPP #define BOOST_FORMAT_IMPLEMENTATION_HPP #include #include #include namespace boost { // -------- format:: ------------------------------------------- basic_format::basic_
aboutsummaryrefslogtreecommitdiff
blob: 5b9ac58ab7f61d61bcec559f99b6584c16203436 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Fix CVE-2019-19126:

https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-19126
https://sourceware.org/bugzilla/show_bug.cgi?id=25204

Taken from upstream:
https://sourceware.org/git/?p=glibc.git;a=commit;h=37c90e117310728a4ad1eb998c0bbe7d79c4a398

diff --git a/sysdeps/unix/sysv/linux/x86_64/64/dl-librecon.h b/sysdeps/unix/sysv/linux/x86_64/64/dl-librecon.h
index 975cbe2..df2cdfd 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/dl-librecon.h
+++ b/sysdeps/unix/sysv/linux/x86_64/64/dl-librecon.h
@@ -31,7 +31,8 @@
    environment variable, LD_PREFER_MAP_32BIT_EXEC.  */
 #define EXTRA_LD_ENVVARS \
   case 21:								  \
-    if (memcmp (envline, "PREFER_MAP_32BIT_EXEC", 21) == 0)		  \
+    if (!__libc_enable_secure						  \
+	&& memcmp (envline, "PREFER_MAP_32BIT_EXEC", 21) == 0)		  \
       GLRO(dl_x86_cpu_features).feature[index_arch_Prefer_MAP_32BIT_EXEC] \
 	|= bit_arch_Prefer_MAP_32BIT_EXEC;				  \
     break;
{ BOOST_ASSERT( item.pad_scheme_ & format_item_t::tabulation); std::streamsize n = item.state_.width_ - res.size(); if( n > 0 ) res.append( n, item.state_.fill_ ); } res += item.appendix_; } return res; } namespace io { namespace detail { template basic_format& bind_arg_body( basic_format& self, int argN, const T& val) // bind one argument to a fixed value // this is persistent over clear() calls, thus also over str() and << { if(self.dumped_) self.clear(); // needed, because we will modify cur_arg_.. if(argN<1 || argN > self.num_args_) { if( self.exceptions() & io::out_of_range_bit ) boost::throw_exception(io::out_of_range()); // arg not in range. else return self; } if(self.bound_.size()==0) self.bound_.assign(self.num_args_,false); else BOOST_ASSERT( self.num_args_ == static_cast(self.bound_.size()) ); int o_cur_arg = self.cur_arg_; self.cur_arg_ = argN-1; // arrays begin at 0 self.bound_[self.cur_arg_]=false; // if already set, we unset and re-sets.. self.operator%(val); // put val at the right place, because cur_arg is set // Now re-position cur_arg before leaving : self.cur_arg_ = o_cur_arg; self.bound_[argN-1]=true; if(self.cur_arg_ == argN-1 ) // hum, now this arg is bound, so move to next free arg { while(self.cur_arg_ < self.num_args_ && self.bound_[self.cur_arg_]) ++self.cur_arg_; } // In any case, we either have all args, or are on a non-binded arg : BOOST_ASSERT( self.cur_arg_ >= self.num_args_ || ! self.bound_[self.cur_arg_]); return self; } template basic_format& modify_item_body( basic_format& self, int itemN, const T& manipulator) // applies a manipulator to the format_item describing a given directive. // this is a permanent change, clear or clear_binds won't cancel that. { if(itemN<1 || itemN >= static_cast(self.items_.size() )) { if( self.exceptions() & io::out_of_range_bit ) boost::throw_exception(io::out_of_range()); // item not in range. else return self; } self.items_[itemN-1].ref_state_.apply_manip( manipulator ); self.items_[itemN-1].state_ = self.items_[itemN-1].ref_state_; return self; } } // namespace detail } // namespace io } // namespace boost #endif // BOOST_FORMAT_IMPLEMENTATION_HPP