Protect again memory overruns.

Get rid of warnings.
This commit is contained in:
mvandervoord
2019-10-23 17:12:18 -04:00
parent 8f1156dddc
commit cda809765e
3 changed files with 16 additions and 3 deletions
+5 -1
View File
@@ -73,7 +73,11 @@ class CMockConfig
treat_as_map.merge!(@options[:treat_as])
@options[:treat_as] = treat_as_map
@options.each_key { |key| eval("def #{key.to_s}() return @options[:#{key.to_s}] end") }
@options.each_key do |key|
unless methods.include?(key)
eval("def #{key.to_s}() return @options[:#{key.to_s}] end")
end
end
end
def load_config_file_from_yaml yaml_filename
+1 -1
View File
@@ -46,7 +46,7 @@ CMOCK_MEM_INDEX_TYPE CMock_Guts_MemNew(CMOCK_MEM_INDEX_TYPE size)
size = size + CMOCK_MEM_INDEX_SIZE;
if (size & CMOCK_MEM_ALIGN_MASK)
size = (size + CMOCK_MEM_ALIGN_MASK) & ~CMOCK_MEM_ALIGN_MASK;
if ((CMock_Guts_BufferSize - CMock_Guts_FreePtr) < size)
if ((CMock_Guts_BufferSize - CMock_Guts_FreePtr) <= size)
{
#ifndef CMOCK_MEM_DYNAMIC
return CMOCK_GUTS_NONE; // nothing we can do; our static buffer is out of memory
+10 -1
View File
@@ -21,8 +21,17 @@ describe CMockPluginManager, "Verify CMockPluginManager Module" do
:ignore => :args_and_calls
)
eval "class << @config\ndef plugins\n@plugins||[]\nend\ndef plugins=(val)\n@plugins=val\nend\nend\n"
def @config.plugins
if instance_variable_defined?(:@plugins)
@plugins || []
else
[]
end
end
def @config.plugins=(val)
@plugins = val
end
end
after do