Improve error messages for bytea decoding failures.
Craig Ringer
This commit is contained in:
parent
8522f21400
commit
f73474382c
@ -292,7 +292,7 @@ b64_decode(const char *src, unsigned len, char *dst)
|
|||||||
else
|
else
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||||
errmsg("unexpected \"=\"")));
|
errmsg("unexpected \"=\" while decoding base64 sequence")));
|
||||||
}
|
}
|
||||||
b = 0;
|
b = 0;
|
||||||
}
|
}
|
||||||
@ -304,7 +304,7 @@ b64_decode(const char *src, unsigned len, char *dst)
|
|||||||
if (b < 0)
|
if (b < 0)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||||
errmsg("invalid symbol")));
|
errmsg("invalid symbol '%c' while decoding base64 sequence", (int) c)));
|
||||||
}
|
}
|
||||||
/* add it to buffer */
|
/* add it to buffer */
|
||||||
buf = (buf << 6) + b;
|
buf = (buf << 6) + b;
|
||||||
@ -324,7 +324,8 @@ b64_decode(const char *src, unsigned len, char *dst)
|
|||||||
if (pos != 0)
|
if (pos != 0)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||||
errmsg("invalid end sequence")));
|
errmsg("invalid base64 end sequence"),
|
||||||
|
errhint("input data is missing padding, truncated, or otherwise corrupted")));
|
||||||
|
|
||||||
return p - dst;
|
return p - dst;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user