Multiplication result converted to larger type
While working on a project with libshumate, these two warnings came up in Github's CodeQL analysis. It couldn't scan the subproject, so I created a mirror repository at https://github.com/andyholmes/libshumate.
The two alerts are as follows:
-
Multiplication result may overflow 'float' before it is converted to 'double'.
base = floor (log (m_per_pixel * scale_width) / log (10));
-
Multiplication result may overflow 'int' before it is converted to 'gsize'.
demos/shumate-test-tile-source.c#L49-53
bytes = g_bytes_new_with_free_func (cairo_image_surface_get_data (surface), cairo_image_surface_get_height (surface) * cairo_image_surface_get_stride (surface), (GDestroyNotify) cairo_surface_destroy, cairo_surface_reference (surface));