[
https://issues.apache.org/jira/browse/THRIFT-3873?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15680198#comment-15680198
]
ASF GitHub Bot commented on THRIFT-3873:
----------------------------------------
Github user hcorg commented on a diff in the pull request:
https://github.com/apache/thrift/pull/1128#discussion_r88791621
--- Diff: compiler/cpp/src/thrift/generate/t_erl_generator.cc ---
@@ -968,10 +969,13 @@ void t_erl_generator::export_string(string name, int
num) {
}
void t_erl_generator::export_types_function(t_function* tfunction, string
prefix) {
-
+ t_struct::members_type::size_type num =
tfunction->get_arglist()->get_members().size();
+ if (num > std::numeric_limits<int>().max()) {
+ throw "integer overflow in t_erl_generator::export_types_function,
name " + tfunction->get_name();
--- End diff --
throwing std::string is an antipattern - it should at least be wrapped in
std::runtime_error
this code is also repeated in couple of places, maybe some utility function
could simplify it?
something like:
`template <typename To, typename From> To safe_numeric_cast(From i) { ... }`
> Fix various compiler warnings when using VS2010
> -----------------------------------------------
>
> Key: THRIFT-3873
> URL: https://issues.apache.org/jira/browse/THRIFT-3873
> Project: Thrift
> Issue Type: Bug
> Components: C++ - Library
> Affects Versions: 0.10.0
> Environment: VS2010, Windows
> Reporter: James E. King, III
> Assignee: James E. King, III
> Priority: Trivial
>
> While verifying a defect I had to build the windows thrift C++ library and
> found a number of compiler warnings that needed to be cleaned up.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)