summaryrefslogtreecommitdiff
path: root/libavutil/log.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavutil/log.c')
-rw-r--r--libavutil/log.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/libavutil/log.c b/libavutil/log.c
index 3b8244889f..abf939d65e 100644
--- a/libavutil/log.c
+++ b/libavutil/log.c
@@ -2,20 +2,20 @@
* log functions
* Copyright (c) 2003 Michel Bardiaux
*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or
+ * FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
- * Libav is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with Libav; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@@ -82,11 +82,20 @@ const char* av_default_item_name(void* ptr){
return (*(AVClass**)ptr)->class_name;
}
+static void sanitize(uint8_t *line){
+ while(*line){
+ if(*line < 0x08 || (*line > 0x0D && *line < 0x20))
+ *line='?';
+ line++;
+ }
+}
+
void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl)
{
static int print_prefix=1;
static int count;
- static char line[1024], prev[1024];
+ static char prev[1024];
+ char line[1024];
static int is_atty;
AVClass* avc= ptr ? *(AVClass**)ptr : NULL;
if(level>av_log_level)
@@ -121,8 +130,9 @@ void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl)
fprintf(stderr, " Last message repeated %d times\n", count);
count=0;
}
- colored_fputs(av_clip(level>>3, 0, 6), line);
strcpy(prev, line);
+ sanitize(line);
+ colored_fputs(av_clip(level>>3, 0, 6), line);
}
static void (*av_log_callback)(void*, int, const char*, va_list) = av_log_default_callback;