Skip to content

Commit 87b7159

Browse files
committedJul 18, 2022
Fix legacy conversion filter for Base64
1 parent 7ece8f1 commit 87b7159

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
 

‎ext/mbstring/libmbfl/filters/mbfilter_base64.c

+13
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,11 @@ int mbfl_filt_conv_base64enc_flush(mbfl_convert_filter *filter)
145145
CK((*filter->output_function)(0x3d, filter->data)); /* '=' */
146146
}
147147
}
148+
149+
if (filter->flush_function) {
150+
(*filter->flush_function)(filter->data);
151+
}
152+
148153
return 0;
149154
}
150155

@@ -170,6 +175,9 @@ int mbfl_filt_conv_base64dec(int c, mbfl_convert_filter *filter)
170175
n = 62;
171176
} else if (c == 0x2f) { /* '/' */
172177
n = 63;
178+
} else {
179+
CK((*filter->output_function)(MBFL_BAD_INPUT, filter->data));
180+
return 0;
173181
}
174182
n &= 0x3f;
175183

@@ -213,6 +221,11 @@ int mbfl_filt_conv_base64dec_flush(mbfl_convert_filter *filter)
213221
CK((*filter->output_function)((cache >> 8) & 0xff, filter->data));
214222
}
215223
}
224+
225+
if (filter->flush_function) {
226+
(*filter->flush_function)(filter->data);
227+
}
228+
216229
return 0;
217230
}
218231

0 commit comments

Comments
 (0)
Please sign in to comment.