This is because the actual number of laser scanning points is more than the set 2048. Therefore, in the file directory openslam_Gmapping/include/gmapping/scanmatcher/scanmatcher.H file, #define laser_Maxbeams 2048 can be set larger than the actual number of laser points.
Recompile after modification.